Commit Graph

26194 Commits

Author SHA1 Message Date
Greg Price 8ca31773cb mypy: Push ignore_missing_imports down to specific modules.
This makes it explicit what libraries we're missing stubs for, and
allows us to work incrementally on shrinking the list.
2018-05-15 18:14:33 -04:00
Eeshan Garg c68627a834 config-file-macro: Specify full path to integration scripts. 2018-05-15 18:02:56 -04:00
Eeshan Garg f29b9f14fd integrations: Update docs for git and codebase.
Doing both as once due to the common dependency on
change-zulip-config-file-indented.md.
2018-05-15 18:02:56 -04:00
Steve Howell ad6de6e268 message_list: Remove unused delay_render option. 2018-05-15 14:25:21 -07:00
Steve Howell 8cb383223d Defer creating messages lists in narrows.
We now work with MessageListData objects while populating
data from local narrows, before actually making the
wrapper MessageList object.

This change will simplify unit testing (less view stuff
to fake out) in certain situations.

It will also allow us to eliminate the delay_render flag.
2018-05-15 14:25:21 -07:00
Steve Howell ff009fadf9 refactor: Have MessageList take in a data object.
We now allow you to initialize a MessageList with
a MessageListData object that you build outside of
the initializer.
2018-05-15 14:25:21 -07:00
Steve Howell a3d3d08a80 refactor: Avoid positional params for MessageList.
We used to have positional parameters for table_name
and filter, but we don't use them for message_list.all
and we're about to replace filter in some cases.

Passing everything in on opts is more consistent and
self-documenting in the calling code, plus lots of
unit tests can get away with passing in `{}` now
for situations where table_name does not matter.

All of our callers pass in muting_enabled, so we
remove the default value for it.  And then the
collapse_messages variable doesn't have to live on
`this` as it's only being passed through down to the
view.
2018-05-15 14:25:21 -07:00
Steve Howell f61ecef138 refactor: Cleanly divide data/view for add_messages.
Before this change, the way to add messages had a lot
of ping-pong-ing between MessageList and MessageListData,
where first the data got triaged, but not actually
inserted into data structures, and then subsequent
calls would add the data and get filtered results.

Now we have a simple API for MessageListData.add_messages
that does all the data stuff up front.  Having a fully
function MLD.add_messages not only makes the ML.add_messages
function about four lines shorter, it also sets us up
to easily build standalone MLD objects before making
the heavier ML objects.
2018-05-15 14:25:21 -07:00
Steve Howell 467fe7ceec refactor: Extract message_list.append_to_view. 2018-05-15 14:25:21 -07:00
Steve Howell 56f872507c refactor: Inline message_list.prepend. 2018-05-15 14:25:21 -07:00
Steve Howell 6834745feb refactor: Inline message_list.add_and_rerender. 2018-05-15 14:25:21 -07:00
Steve Howell 08fd2027a1 Refine offset logic for narrows.
We now only preserve the offset for the previous
selection (pre-narrow) if that is still the id
we want selected after calling maybe_add_local_messages.

Right not this does not change any behavior, but
upcoming changes to maybe_add_local_messages will
change the selected id to the first unread message
in certain circumstances, in which case preserving
the offset will possibly be confusing, since you're
not on the same message.
2018-05-15 14:25:21 -07:00
Steve Howell 0dea143fcf Use unread data in topic_data.get_recent_names().
Fixes #9347.
2018-05-15 14:25:21 -07:00
Steve Howell 9b4a4d09ea Add unread.get_missing_topics().
We will need this for cases where the topic names in
unread.js are a superset of the names we got from messages.

It's important to pass in a dict of existing dicts to avoid
expensive max() calls to get the max ids of topics (otherwise
the plan would have been to merge the lists in the caller).
2018-05-15 14:25:21 -07:00
Tim Abbott 31ce382e71 coverage: Disable coverage checking for exceptions.py.
We also take the opportunity to slightly improve the errors if
AbstractEnum ever gets used.
2018-05-15 13:57:40 -07:00
Tim Abbott badfec2b49 coverage: Don't include settings files in test coverage. 2018-05-15 13:55:01 -07:00
Tim Abbott 191e6dc13a create_user: Remove user_profile_id option.
This hasn't been used in years, had no test coverage, and doesn't have
a clear use case.
2018-05-15 13:51:56 -07:00
= e731aeda44 zerver: Remove dead code from do_change_password. 2018-05-15 13:39:53 -07:00
= 9d07faaf0c zerver: Remove dead code from do_create_realm. 2018-05-15 13:39:53 -07:00
= 344d6544da zerver: Remove dead code for accessing subscribers.
These haven't been used in years, and clutter the codebase.
2018-05-15 13:39:39 -07:00
Yashashvi Dave 8909836815 zerver/tests/test_custom_profile_data.py: Refactor tests.
Refactor custom fields creation and deletion tests to assert
if created/deleted field exist or not, instead of asserting
total count of all realm fields.
2018-05-15 12:38:18 -07:00
Yashashvi Dave d66d2445b4 custom fields: Don't ask org admin to enter "value" for choice.
When org admin add choice type of custom profile fields, set
numeric ID for choices instead of asking "value" from org admin.
2018-05-15 12:08:29 -07:00
Yashashvi Dave ece6b68e4c custom fields: Remove minor bugs in custom profile org settings.
Remove minor bugs like reset create-field form, on submit.
Set initial true values in edit-field form.
2018-05-15 12:08:29 -07:00
Yashashvi Dave ffe986886f custom fields: Fix field value not saved on change, just after created.
Whenever custom fields templates get rendered within user account
settings, on-change event listener wasn't get created. Cause
event listener wasn't set properly.
2018-05-15 12:08:29 -07:00
Shubham Padia 3703013b4f models: Add `is_announcement_only` to Stream.to_dict(). 2018-05-15 12:05:52 -07:00
Baron Chandler f59adfa67c actions: Change do_change_is_admin Exception to an Assertion Error.
- do_change_is_admin now raises AssertionError when a non-admin
  permission is given.
- adds test to test_users to ensure admin asserts on invalid
  permission values.
2018-05-15 11:27:01 -07:00
Baron Chandler 4bdc8332fa zerver: Require permissions be acceptable to do_change_is_admin. 2018-05-15 11:25:47 -07:00
Alena Volkova ba9668470c emoji: Don't start typeahead for colon-space.
Fixes #9339.
2018-05-15 11:18:08 -07:00
Yago González 35577a1f66 api docs: Rename Swagger directory to OpenAPI. 2018-05-15 11:05:03 -07:00
Yago González f9f8d9c578 bugdown: Parse argument JSON files as streams. 2018-05-15 11:05:03 -07:00
RobbieClarken f81b936727 zerver/tests: Require 100% test coverage of zerver/lib/upload.py.
The last line here is impossible to test.

Fixes #4489.
2018-05-15 10:52:20 -07:00
RobbieClarken 17d6d4fed1 zerver/tests: Add test for get_emoji_url for local upload backend. 2018-05-15 10:50:39 -07:00
RobbieClarken fb42b58316 zerver/tests: Test emoji upload for local storage backend. 2018-05-15 10:50:39 -07:00
RobbieClarken 2dc13d6b50 zerver/tests: Test ensure_medium_avatar_url when the file exists. 2018-05-15 10:50:39 -07:00
RobbieClarken 398141268f zerver/tests: Test get_emoji_url for S3. 2018-05-15 10:50:39 -07:00
RobbieClarken dd19ed3972 zerver/tests: Test upload emoji to S3. 2018-05-15 10:50:39 -07:00
RobbieClarken ff95c67197 zerver/tests: Test upload realm icon for S3. 2018-05-15 10:50:39 -07:00
RobbieClarken 25e91b289d zerver/tests: Test delete message image from S3 when file is missing. 2018-05-15 10:50:39 -07:00
RobbieClarken b3a6c0a253 zerver/tests: Test currently_used_upload_space function. 2018-05-15 10:50:38 -07:00
RobbieClarken efc63d4ca0 zerver/tests: Test S3 file upload with undefined content type. 2018-05-15 10:42:10 -07:00
RobbieClarken b9fff04f39 zerver/tests: Add test for resize_emoji for images that need resizing. 2018-05-15 10:42:10 -07:00
RobbieClarken 69a5ce102f zerver/tests: Remove unecessary re-open on files in tests.
The get_test_image_file helper function returns a file handle so we can
call the read method on this directly.
2018-05-15 10:42:10 -07:00
RobbieClarken f34d9dc910 zerver/tests: Test get_realm_for_filename when filename doesn't exist. 2018-05-15 10:42:10 -07:00
Yashashvi Dave 80beb51836 edit bot: Fix error on updating no-owner-bots name.
When org admin tries to change only bots name of no-owner-bot,
It update bots name but returns error, "No such bot owner".
Cause frontend pass `null` value in `bot-owner`.
2018-05-15 10:35:19 -07:00
Yashashvi Dave 0554e68528 static/templates/edit_bot.handlebars: Fix undefined bot_id.
Template was rendering undefined value of `bot_id` instead of
`user_id`.

Fix this by replacing `bot_id` with `user_id` and changing
template data variable to `data-user-id` to avoid
future confusion.
2018-05-15 10:35:19 -07:00
Tim Abbott 8a66b0b9a9 docker: Set has_appserver=0 correctly.
The docker installer configuration incorrectly had has_appserver set
to 0; this meant that (A) the docker-zulip code needed to copy the
block of code in the installer for the `has_appserver` case into the
Dockerfile (unnecessarily), and (B) one couldn't use `install` from a
Git ref (because the static asset compiler didn't end up in the right
place).

It appears that docker-zulip tried to set this flag in their `install`
command line, but the construction inside `install` meant that didn't
work.
2018-05-15 10:13:44 -07:00
Baron Chandler 52d53f4a81 test_subs: Ensure gather_subscriptions_helper excludes deleted streams. 2018-05-15 10:11:32 -07:00
Hendy Irawan bb5457c2f7 docs: Clarify need to provision from /srv/zulip when troubleshooting.
Text tweaked slightly by tabbott.
2018-05-15 09:43:09 -07:00
Shubham Padia f0d874d51f hashchange: Handle trailing slashes in narrowing URLs.
Fixes #9305.
Empty operators are not allowed while parsing narrowing URLs.
`parse_narrow` stops parsing further if it encounters an empty string
operator.
2018-05-15 09:34:50 -07:00
Aman Ghebreweldi 83ee8211a8 third: Get sorttable package from npm.
We didn't have any local changes, so there's no need to have it
vendored in the repository.
2018-05-15 09:25:48 -07:00