Commit Graph

43132 Commits

Author SHA1 Message Date
Suyash Vardhan Mathur 246262fb57 openapi: Modify curl example generation logic.
This commit adds support for using the
x-curl-examples-parameters parameter in OpenAPI
data to fetch curl examples configuration. This
also contains any descriptions necessary for each
example, and directly generates all possible
curl examples directly.

A follow-up commit is needed to modify the templates
accordingly.
2021-06-21 11:06:05 -07:00
Suyash Vardhan Mathur a56ad2a26a openapi: Add curl examples' configurations in OpenAPI data.
As a goal of moving towards a common template,
we need to fetch curl examples' configurations
directly from openapi data instead of having them
hardcoded in templates. This commit introduces
x-curl-examples-parameters to store the configs
for the same.
2021-06-21 11:06:05 -07:00
Abhijeet Prasad Bodas c6d696cf61 process_message_event: Deduplicate `is_notifiable` logic.
We use the `UserMessageNotificationsData` methods to check if the
message is notifiable, and use a cleaner early continue pattern.
2021-06-21 10:52:59 -07:00
Abhijeet Prasad Bodas 5c483e3b58 get_active_presence_idle_user_ids: Check notifiability more thoroughly.
* Have the `get_active_presence_idle_user_ids` function look at all the
user data, not just `private_message` and `mentioned`.
* Fix a couple of incorrect `missedmessage_hook` tests, which did not
catch the earlier behaviour.
* Add some comments to the tests for this function for clarity.
* Add a helper to create `UserMessageNotificationsData` objects from the
user ID lists. This will later help us deduplicate code in the event_queue
logic.

This fixes a bug which earlier existed, that if a user turned on stream
notifications, and received a message in that stream which did not mention
them, they wouldn't be in the `presence_idle_users` list, and hence would
never get notifications for that message.

Note that, after this commit, users might still not get notifications in
the above scenarios in some cases, because the downstream logic in the
notification queue consumers sometimes erroneously skips sending
notifications for stream messages.
2021-06-21 10:52:59 -07:00
Abhijeet Prasad Bodas aeb2ad5f46 notification_data: Annotate `flags` with `Collection`.
Since `flags` here could be iterated through multiple times
(to check for push/email notifiability), we use `Collection`.
Inspired by 871e73ab8f.

The other change here in the `event_queue` code is prep for using
the `UserMessageNotificationsData` class there.
2021-06-21 10:52:59 -07:00
Abhijeet Prasad Bodas 8182632d7e notification_data: Add methods to determine notifiability.
We will later consistently use these functions to check for notifiable
messages in the message send and event_queue code.

We have these functions accept the `sender_id` so that we can avoid the
`private_message = message["type"] == "private" and user_id != sender_id`
wizardy.
2021-06-21 10:52:59 -07:00
Abhijeet Prasad Bodas ed58393079 message send: Optimize how user data is sent to Tornado.
Before this commit, we used to pre-calculate flags for user data and send
it to Tornado, like so:
```
{
    "id": 10,
    "flags": ["mentioned"],
    "mentioned": true,
    "online_push_enabled": false,
    "stream_push_notify": false,
    "stream_email_notify": false,
    "wildcard_mention_notify": false,
    "sender_is_muted": false,
}
```

This has the benefit of simplifying the logic in the event_queue code a bit.

However, because we sent such an object for each user receiving the event,
the string keys (like "stream_email_notify") get duplicated in the JSON
blob that is sent to Tornado.

For 1000 users, this data may take up upto ~190KB of space, which can
cause performance degradation in large organisations.

Hence, as an alternative, we send just the list of user_ids fitting
each notification criteria, and then calculate the flags in Tornado.
This brings down the space to ~60KB for 1000 users.

This commit reverts parts of following commits:
- 2179275
- 40cd6b5

We will in the future, add helpers to create `UserMessageNotificationsData`
objects from these lists, so as to avoid code duplication.
2021-06-21 10:52:59 -07:00
Abhijeet Prasad Bodas 6167c36adc event_queue: Translation code for user data migration.
This is separate from the next commit for ease of testing.
To verify that the compatibility code works correctly, all message send
and event_queue tests from our test suite should pass on just this commit.
2021-06-21 10:52:59 -07:00
aryanshridhar 477a066a4c delete_message: Move and rename the delete_message modal.
Moved the `delete_message` user-confirmation modal to
the `confirm_dialog` folder and renamed the modal to `confirm_delete_message.hbs`
to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar df556a199a settings_invites: Move and rename the revoke_invite modal.
Moved `revoke_invite` user-confirmation modal to the
`confirm_dialog` folder and renamed the modal to
`confirm_revoke_invite.hbs` to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar d0c683a8d7 settings_invites: Move and rename the resend_invite modal.
Moved `resend_invite` user-confirmation modal to the
`confirm_dialog` folder and renamed the modal to
to `confirm_resend_invite.hbs` to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 83473ba647 settings_emoji: Move and rename the emoji_settings_warning modal.
Moved `emoji_settings_warning` modal to the `confirm_dialog`
folder and renamed the modal to `confirm_emoji_settings_warning.hbs`
to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 4549cbe48c settings_users: Move and rename the deactivation_user modal.
Moved `deactivation_user` modal to the `confirm_dialog`
folder within `/static/templates` and renamed the modal to
to `confirm_deactivate_user.hbs` to follow the
common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar c5d65555fa deactivation_stream: Move and rename the deactivation_stream modal.
Moved `deactivation_stream` user-confirmation modal to
the `confirm_dialog` folder and renamed the modal to
`confirm_deactivate_stream.hbs` to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 803a6dd60a deactivate_realm: Move and rename the deactivate_realm modal.
Moved `deactivate_realm` modal to the `confirm_dialog` folder
within `/static/templates` and renamed the modal to
`confirm_deactivate_realm.hbs` to follow the naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 7fc8d97daa avatar: Move delete_user_avatar_modal to confirm_dialog folder.
Moved `confirm_delete_user_avatar` modal to the `confirm_dialog`
folder.
2021-06-21 10:36:35 -07:00
aryanshridhar 1d5f63564a user_groups: Move confirm_delete_user_modal to confirm_dialog folder.
Moved `confirm_delete_user` modal to the `confirm_dialog`
folder.
2021-06-21 10:36:35 -07:00
aryanshridhar 48a7f95fc8 muting_ui: Move confirm_mute_user modal to confirm_dialog folder.
Moved `confirm_mute_user` modal to `confirm_dialog` folder.
2021-06-21 10:36:35 -07:00
aryanshridhar 3cad4c7837 starred_messages_ui: Move user-confirmation modals to confirm_dialog folder.
Moved `confirm_unstar_all_messages` and `confirm_unstar_all_messages_in_topic`
modals to the `confirm_dialog` folder.
2021-06-21 10:36:35 -07:00
aryanshridhar beab7ea1dc delete_topic: Move and rename the delete_topic modal.
Moved `delete_topic` modal to `confirm_dialog` folder and
renamed the modal to `confirm_delete_topic.hbs`
to follow the confirm_dialog naming conventions.
2021-06-21 10:36:35 -07:00
aryanshridhar 1db2fbcd77 stream_create: Move and rename the subscription_invites_warning modal.
Moved `subscription_invites_warning` modal to `confirm_dialog`
folder and renamed the modal to `confirm_subscription_invites_warning.hbs`
to follow the naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar db0a69648a subs: Move and rename the unsubscribe_private_stream modal.
Moved `unsubscribe_private_stream` modal to the newly created
`confirm_dialog` folder found within `static/templates`.

Later renamed the modal to `confirm_unsubscribe_private_stream.hbs`
to follow a common naming convention.
2021-06-21 10:36:35 -07:00
Ganesh Pawar d9d7c55006 user_deactivation: Move modal_parent one level up in the DOM.
The user deactivate button is also present in the "Deactivated users"
tab, a sibling element of the current modal_parent, #admin-user-list.
Adding the confirm_dialog modal to #admin-user-list won't have any
effect in the "Deactivated users" tab.
Move it one level up, i.e. to the parent element of #admin-user-list
and #admin-deactivated-users-list.

Fixes #18928.
2021-06-21 10:22:33 -07:00
Gaurav Pandey e648ad3477 ci: Add prod upgrade step to prod suite.
This adds a check in the current production suite of
CI that upgrades a previous release of zulip server
with a newer one.

Fixes #18346.
2021-06-21 10:15:24 -07:00
Ganesh Pawar 777eeb6b8f subs: Update `sub` object with additional properties in update_* functions.
Subsequent function calls require additional properties present
after calling `get_sub_for_settings` on the original sub object.

Fixes #18602
2021-06-20 17:08:16 -07:00
Ganesh Pawar 8c65b971c6 stream_creation_form: Replace `everyone` with `public` in stream_privacy_policy.
The passed `stream_privacy_policy_values` object
doesn't contain the `everyone` property.
2021-06-20 17:08:16 -07:00
Ganesh Pawar 6392a7122b open_modal: Pass extra arguments as object. 2021-06-20 17:08:16 -07:00
Priyank Patel 05510a8c04 github-actions: Upgrade styfle/cancel-workflow-action. 2021-06-20 16:53:45 -07:00
Priyank Patel 607110ca33 github-actions: Ensure cancel previous run job never fails. 2021-06-20 16:53:45 -07:00
Aman Agrawal ad59fae407 lightbox_overlay: Fix `&` not being rendered as desired.
The attempt to render `&` doesn't work. So, just replacing it
with `and` to make it always work.
2021-06-20 12:46:30 -04:00
Dinesh b92d9fb77c docs: Mention about test_example.py in testing-docs. 2021-06-20 07:16:35 -04:00
Dinesh a71ee405e4 test_example: Add a few more common testing methods.
Adds an example to illustrate the use of:
* self.settings()
* self.assertLogs()
* self.assert_in_success_response()
2021-06-20 07:16:35 -04:00
Ganesh Pawar 147cd8a366 message_edit_history: Dynamically load modal rather than statically.
message_history_cancel_btn is shifted down since the modal isn't
present before `show_history` is called.
2021-06-18 18:13:00 -07:00
Ganesh Pawar e73644593c message_edit_history: Move click handlers to message_edit_history.js. 2021-06-18 18:13:00 -07:00
Ganesh Pawar 72b1d3b5a6 deprecated_feature_notice: Make use of autoremove option in open_modal. 2021-06-18 18:13:00 -07:00
Ganesh Pawar 0b769bfcc8 overlays: Add `autoremove` option to `open_modal`.
`autoremove` will remove the modal element from the DOM
once the modal is hidden.
2021-06-18 18:13:00 -07:00
Ganesh Pawar f453db0df2 about_zulip: Mark strings for translation. 2021-06-18 18:13:00 -07:00
Ganesh Pawar a0e5a82d23 confirm_dialog: Correct documentation regarding loading_spinner. 2021-06-18 18:12:59 -07:00
Tim Abbott 10dcc4ac98 refactor: Use consistent name for RESOLVED_TOPIC_PREFIX. 2021-06-18 17:47:57 -07:00
Tim Abbott bfb6ff44d1 message_edit: Fix unicode encoding of resolve topic check.
We now encode resolved topics with just:

U+2714 HEAVY CHECK MARK, SPACE

Previously, the encoding was unintentionally this:

U+2714 HEAVY CHECK MARK, U+FE0F VARIATION SELECTOR-16, SPACE
2021-06-18 17:46:28 -07:00
Tim Abbott c705b7d5dd popover_menus: Add some comment documentation. 2021-06-18 17:25:45 -07:00
Aman Agrawal fa2825eaa0 popover_menus: Extract common popover properties to be reused. 2021-06-18 17:13:20 -07:00
Aman Agrawal 182f47b7c6 popover_menus: Extract popovers using tippy in a separate module. 2021-06-18 17:13:20 -07:00
Aman Agrawal 563f8aba1e compose_mobile_button: Use tippyjs for popover.
There are several benefits of using tippyjs here:
* Removes dependency on bootstrap.
* We don't have to manually handle show/hide of popover.
* There cannot be any memory leak since we don't store
  the instance.
2021-06-18 17:13:19 -07:00
Aman Agrawal f171b436f3 tippy: Hide stream settings popover on pressing `escape`.
Like all popovers, this behavior should be the same for tippy
popovers too.
2021-06-18 17:12:58 -07:00
Aman Agrawal 7c6fc5dff7 tippyjs: Use `one` instead of `on` to define event handlers.
Since the instance.popper can return same elements as the
instance may be used again by tippy, we use `one` to ensure
that we do not define multiple event handlers for the same element
repeatedly.
2021-06-18 17:12:58 -07:00
Aman Agrawal 444e9cd93f tippyjs: Show popovers on touch.
For tooltips we have set default to only show when pressed for a
small duration. For popovers, we show them on a simple touch.
2021-06-18 17:12:58 -07:00
Tim Abbott 081d74141b overlays: Don't close overlays when drawing selections.
This fixes the following bug:
* Open the streams modal.
* Click and hold in the word "Streams" at the top.
* Move pointer up out of the modal.
* Release.
* Expected: Some text is selected, but nothing else happens.
* Actual: The modal disappears.

We use the same fix we use for this class of issue in other places:
checking for whether a range is selected, and if so, doing nothing.
2021-06-18 17:01:19 -07:00
Tim Abbott a307de95de right sidebar: s/Filter users/Search people/.
We previously had a mix of "Filter users" and "Search people" for this
widget. "Search" is more correct because the right sidebar can only
show a subset of the organization in some settings.
2021-06-18 16:41:37 -07:00
aryanshridhar 8cd9fc7a74 popovers: Close user popover when clicked on stream name.
Earlier, when a user clicked on any stream name from the
user_popover, the stream page would open in the background,
but the user popover wouldn't close.

Fixed it by explicitly binding it to a click handler,
which closes the user popover before redirecting to stream
page.
2021-06-18 16:07:45 -07:00