Commit Graph

30640 Commits

Author SHA1 Message Date
Greg Price ccc1f3cd85 push notif tests: Stop importing module as bizarre name `apn`. 2019-02-08 15:18:12 -08:00
Greg Price c372ceb7a2 push notif tests: Use mock.patch instead of `apn.gcm = ...`. 2019-02-08 15:18:12 -08:00
Greg Price e289c5835d push notif tests: Use mock.patch instead of `apn.gcm = None`.
This is what it's for -- and it cleans up after itself, too.
2019-02-08 15:18:12 -08:00
Greg Price ff12072f18 push notif: Skip four layers of setup for some pure unit tests.
This saves about 50ms, for just four test cases.
2019-02-08 15:18:12 -08:00
Greg Price 1e11e929ec push notif: Guess a GCM `priority` on behalf of old servers. 2019-02-08 15:18:12 -08:00
Greg Price a293aeee23 push notif: Explicitly set GCM priority `normal` for remove.
If we make a practice on the Zulip server of always explicitly setting
the desired priority, then when an old server doesn't set the priority
we can reasonably have the bouncer make a guess.
2019-02-08 15:18:12 -08:00
Greg Price ffabebd7f3 push notif: Set GCM priority `high` for real notifications.
This is the payoff of this branch!  Fixes zulip/zulip-mobile#3185.
2019-02-08 15:18:12 -08:00
Greg Price 699bf262ca push notif: Test GCM options parsing more comprehensively.
The payoff from making these into real unit tests.
2019-02-08 15:18:12 -08:00
Greg Price 02ba302009 push notif: Simplify tests for parsing GCM options.
Huzzah for unit tests!
2019-02-08 15:18:12 -08:00
Greg Price f1cb9be79c push notif: Consolidate and simplify GCM tests. 2019-02-08 15:18:12 -08:00
Tim Abbott 925bf7b907 message_list: Move update_group_date_divider earlier.
We need to move the update_group_date_divider call to run when a
message group is created.  This achieves a few things:

* Fixes calling this multiple times useless for long message groups.
* It will soon no longer be correct to assume that every message
within a group has the same date, and in that case, we want to process
the date of the first message in the group, not of the last.
2019-02-08 14:54:40 -08:00
Tim Abbott 31e98b8b65 message_list: Remove extra calls to update_timestr.
We only generate message_containers in one place, and that code path
already calls update_timestr.  And update_timestr's effect only
depends on the message.  Thus, this code was useless.
2019-02-08 14:51:03 -08:00
Tim Abbott 7fd582025f message_list: Extract render_group_display_date. 2019-02-08 11:45:21 -08:00
Tim Abbott 0aa438e199 message_list: Rename update_group_time_display.
The name now reflects that this is about date dividers.
2019-02-08 11:30:58 -08:00
Tim Abbott 21a86f3ef7 message_list: Rename show_date_separator to show_group_date_divider. 2019-02-08 11:30:15 -08:00
Tim Abbott 0d66d3fafd message_list: Rename show_date to group_date_divider_html.
This is much more clear about what this actually means.
2019-02-08 11:26:24 -08:00
Tim Abbott 72bb3fb6c2 message_list: Extract clear_date_divider_html.
This also fixes the fact that the logic had swapped which object
should be undefined and which should be false.
2019-02-08 11:20:00 -08:00
Rishi Gupta fe28d0731e org settings: Move "allow message content in email" to different subsection. 2019-02-08 10:16:09 -08:00
Rishi Gupta 3a26daf911 org settings: Remove unnecessary titles from Organization settings. 2019-02-08 10:16:09 -08:00
Rishi Gupta 65f6bea7d7 org settings: Move video chat provider into other settings. 2019-02-08 10:16:09 -08:00
Rishi Gupta 16042ba15d org settings: Reorder the major sections of Organization settings. 2019-02-08 10:16:09 -08:00
Rishi Gupta 76488bd2fe settings: Remove button styling from role. 2019-02-08 10:16:09 -08:00
Anders Kaseorg dec8c7dba4 provision: Run generate_secrets earlier.
Commit 7d12e2019d (#10994) broke fresh
provisions by importing zproject.settings before we were done
modifying settings.  Fix it by moving the generate_secrets invocation
to the earliest reasonable place.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-08 10:13:18 -08:00
Tim Abbott a2373a63cd capitalization: Add GCM to list of proper nouns.
This fixes failures in master from the recent GCM merge.
2019-02-08 10:11:55 -08:00
Greg Price 6da9aeee7d push notif: Expand and clarify docs on GCM options. 2019-02-08 09:44:00 -08:00
Greg Price 674b254b65 push notif: Accept GCM `priority` option.
That is, this allows a Zulip server to now set the `priority`; but if
it doesn't, we use upstream's default value, which has the same effect
as we've always previously had by not setting it at all.

But when this is deployed to the push notifications bouncer server, it
does allow another server to set priority when pushing notifications
through the bouncer.
2019-02-08 09:42:59 -08:00
Greg Price 575f320009 push notif: Factor out a helper parse_gcm_options.
Looks a bit silly as is, but this will give us a good home for
logic to start parsing more than zero allowed options.
2019-02-08 09:41:07 -08:00
Greg Price 9ebad5d505 push notif: Reorg `send_android_...` slightly for clarity.
In particular, get the `remote`/`DeviceTokenClass` bit out from
in between `json_request` and the various bits of code preparing
for it.
2019-02-08 09:40:45 -08:00
Greg Price 49fd2e65de push notif: Add GCM options to bouncer API; empty for now.
The first use case for this will be setting `priority`,
coming up shortly.
2019-02-08 09:40:43 -08:00
Eeshan Garg 3470e541c8 internal_send_stream_message: Support accepting a Stream object.
If the caller has access to a Stream object, it is wasteful to
query a database for a stream by ID or name. In addition, not
having to go through stream names eliminates various classes of
possible bugs involved with re-fetching the Stream object by name.
2019-02-08 08:59:03 -08:00
Eeshan Garg c240008edb internal_prep_stream_message: Support accepting a Stream object.
If the caller has access to a Stream object, it is wasteful to
query a database for a stream by ID or name. In addition, not
having to go through stream names eliminates various classes of
possible bugs involved with getting a Stream object back.
2019-02-08 08:53:16 -08:00
Abhinav Singh 849c296f90 popovers: Fix 'w' hotkey in narrow windows.
In small screen sizes, when the user presses shortcut `w` to search
for another user, the hide_all function calls in the search code path
would hide the right sidebar, immediately after opening it, making the
hotkey basically unusable.

We fix this by extracting a separate hide method that hides all true
popovers, but not the user list sidebar.

Fixes #11463.
2019-02-08 08:42:34 -08:00
Puneeth Chaganti b6cf14608d upload: Ensure correct textarea is focused when an upload finishes.
The `uploadFinished` code switches on the composing mode, if we aren't
in the composing mode already. This causes the focus to be incorrect
when this code path runs due to an upload from the message edit
box. This commit fixes that logic to turn on the composing mode or
switches focus to the message edit box, depending on where the upload
was triggered.
2019-02-08 07:45:41 -08:00
Steve Howell d7f9a21519 api docs: Move json-api-example css to portico.scss.
We didn't need to patch the third-party bootstrap code for this.
2019-02-08 07:42:32 -08:00
Anders Kaseorg e4832cc9da setup_path_on_import: Don’t re-add BASE_DIR to sys.path.
BASE_DIR must already be in sys.path if we got as far as importing
this.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-07 17:17:31 -08:00
Anders Kaseorg 8fdb62a6bc tools: Create DEPLOY_ROOT/zulip-py3-venv symlink in development too.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-07 17:12:33 -08:00
Anders Kaseorg 70bfcd3402 zulip_tools: Extract get_deploy_root function.
Modified by tabbott from the original to preserve the implementation;
see https://github.com/zulip/zulip/pull/11295#discussion_r254925032
for why this is correct.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-07 17:09:29 -08:00
Tim Abbott 4826393ec4 hipchat: Fix help documentation for slim_mode. 2019-02-07 16:17:01 -08:00
Vishnu Ks 0ed6dab806 invites: Show multiuse invite button only to admins. 2019-02-07 15:41:00 -08:00
Vishnu Ks 6ed6bcef05 invites: Move multiuse invite status to footer. 2019-02-07 15:41:00 -08:00
Vishnu Ks b62bd83083 invites: Add generate multiuse invite button. 2019-02-07 15:41:00 -08:00
Vishnu Ks 28769e040f invites: Add backend for multiuse admin invites. 2019-02-07 15:41:00 -08:00
Steve Howell 0e65e74566 refactor: Make build_topic_popover() not rely on HTML.
Now all the markup-specific finding of elements just
happens in the click handler.
2019-02-07 15:19:55 -08:00
Steve Howell b5347c78b2 scrolling: Fix sidebar size calculation.
So the top navbar is above the left sidebar
on the z-axis, not the y-axis.

So it doesn't make sense to use the top
navbar in calculating the size of the left
sidebar.

It kind of coincidentally works, since these
two numbers are closely related:

    left sidebar top margin = 50
    navbar height = 40

Calculating `bottom_sidebar_height` correctly
decreases its value by 10.

And then the only value that depends on it
is `stream_filters_max_height`.  We were
subtracting out 10 there to make it work,
since `bottom_sidebar_height` was inaccurate
by +10.  Now that's fixed.

The comment there was inaccurate--the
`stream_filter` div actually has a bottom
margin of 22px.  The bottom margin does
have some consequences for scrolling,
but the main goal here is to make the
calculation return the same value but
be more accurate about what happens
toward the top of the screen.
2019-02-07 15:19:55 -08:00
Steve Howell e7ead7383d css: Add explicit padding below the navbar.
We have always intended to have 10px of whitespace
below the navbar, and this enforces it directly
and explicitly in the CSS.

Note that the three major panels still should
have a margin of 50px, which is equal to
the safe outer height of the header (40px + 10px).
2019-02-07 22:36:08 +00:00
Eeshan Garg 4da28970fa addressee: Rename for_stream to for_stream_name.
The name for_stream_name is more appropriate here.  The name
for_stream is more suitable for a function that takes in a Stream
object, which we're about to add.
2019-02-07 13:41:24 -08:00
Tim Abbott 970c7d1ddf notifications: Fix hash-named duplicate sound files in options.
Our hash-naming of production assets interacted badly with the "look
at files in a directory" algorithm used to determine what sound
options exist for the "notification sound" feature.  For lack of a
better solution, we fix this by excluding files with an extra `.` in
their name.
2019-02-07 13:36:41 -08:00
Rishi Gupta 0f3125582b org settings: Reposition instructions for user groups, and hide from guests. 2019-02-07 11:46:09 -08:00
Rishi Gupta 9f2995a6f6 org settings: Reorder options under org permissions -> other permissions. 2019-02-07 11:46:09 -08:00
Rishi Gupta 9572c5ddb0 org settings: Update explanation for Default user settings. 2019-02-07 11:46:09 -08:00