Commit Graph

26204 Commits

Author SHA1 Message Date
Steve Howell 9eb3bdaf6c page load: Make initializations more explicit.
We now initialize most modules in ui_init.js, which
isn't the perfect place to do it, but at least now
we have a mostly consolidated entry point.

All the new foo.initialize() methods introduced in
this module run the same order relative to each
other as before this commit. (I did some console
logging with a hacked version of the program to
get the order right.)  They happen a bit later than
before, though.

A couple modules still have the `$(function() {`
idiom for miscellaneous reasons:

       archive - is a different bundle
       common - used elsewhere
       list_render - non-standard code style
       scroll_bar - no exports
       setup - probably special?
       socket - $(function () is nested!
       transmit - coupled to socket
       translations - i18n is a bigger problem
       ui_init - this bootstraps everything
2018-05-15 15:46:04 -07:00
Steve Howell c7731a7ebb Move functions into ui.initialize().
We had three different initialization entry points
for ui.js, which seems a bit excessive. :)
2018-05-15 15:43:55 -07:00
Steve Howell b8f12728bc Rename invite.initialize() to invite.launch().
We generally want initialize() functions to only run
once at startup, whereas launch() is consistent with
other modals.
2018-05-15 15:43:55 -07:00
Tim Abbott 9498260516 puppet: Include process_fts_updates in dockervoyager manifest.
This is preferred, since we don't currently have a way to run Django
logic on the postgres hosts with the Docker implementation.

This is a necessary part of removing the need for the docker-zulip
package to patch this file to make Zulip work with Docker.
2018-05-15 15:37:12 -07:00
Tim Abbott ee3cd95bd1 puppet: Remove python 2 psycopg2 package.
We no longer need this, since we're a Python 3 project now.
2018-05-15 15:37:12 -07:00
Tim Abbott bd5e2ddc74 puppet: Extract zulip::process_fts_updates.
In theory, one might want to run this either on the postgres server or
on an application server.
2018-05-15 15:37:12 -07:00
Greg Price 6dbd90835b mypy: Move remaining exclusion list to config file.
This leaves the wrapper script with very little left to do!

The main thing left is finding scripts by searching for shebang lines;
mypy itself would happily do the search for importable Python files.
2018-05-15 18:14:33 -04:00
Greg Price 4c500bba64 mypy: Explain a bit more about the failed imports of API code. 2018-05-15 18:14:33 -04:00
Greg Price ae3f461e02 mypy: Explain what's up with the failed imports of our own code. 2018-05-15 18:14:33 -04:00
Greg Price fa18913b8b test_helpers: Fix a nonexistent import.
This module doesn't exist, and never did; the name appears to be a
mistaken variant of the module that really does contain ZulipTestCase.
So, fix the import to use the real name.

This would never have worked at runtime, which is why it's in an
`if False:`.  It's also an example of the kind of error that can be
hidden by `ignore_missing_imports`; we'd have caught the issue
immediately if we hadn't had a blanket application of that flag
in place.
2018-05-15 18:14:33 -04:00
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