Commit Graph

43786 Commits

Author SHA1 Message Date
sahil839 e0faa9699d api: Remove incorrect realm setting in 'realm/update_dict' schema.
We incorrectly include many realm settings in the data section of
'realm/update_dict' schema. It should only contain the settings
related to message edit, realm icon, realm logo and authentication
methods and not other settings, becausea all the other settings send
'realm/update' event and not 'realm/update_dict' event.

This commit only removes 'add_emoji_by_admins_only' and others will
be removed separately.
2021-07-14 14:57:09 -07:00
sahil839 6a3f22480d settings_emoji: Rename can_admin_emoji to can_delete_emoji. 2021-07-14 14:57:09 -07:00
sahil839 61acf68aa4 emoji: Allow emoji authors to delete the emoji always.
Previously, non-admin emoji authors were allowed to
delete the emoji only if add_emoji_by_admins_only
was false. But, as add_emoji_by_admins_only setting
is for who can add emoji and not delete emojis, it
should not affect the behavior of deleting emojis
and users should always be allowed to delete the
emojis which. they added themselves
2021-07-14 14:57:08 -07:00
Kerry Jackson 5d91a34119 search_icon: Fix contrast color of icon.
Fixes #19053.
2021-07-14 14:53:45 -07:00
sahil839 e736d9d275 settings: Add moderators and full members options in user-group setting.
This commit adds moderators and full members options for user group
settings in frontend.
2021-07-14 14:38:44 -07:00
sahil839 50240ca71b models: Use COMMON_POLICY_TYPES for user_group_edit_policy.
This commit adds moderators and full members options for
user_group_edit_policy by using COMMON_POLICY_TYPES.

Moderators do not require to be a member of user group in
order to edit or remove the user group if they are allowed
to do so according to user_group_edit_policy.
But full members need to be a member of user group to edit
or remove the user group.
2021-07-14 14:38:44 -07:00
sahil839 93a1479286 user_group: Change error message to "Insufficient permission".
There is no need to have a error message which specifies the
roles having permission to edit user-groups, we can simply
have error message as "Insufficient permission" as we already
show the roles having permission clearly in UI.
2021-07-14 14:38:43 -07:00
sahil839 1148937c7b settings: Show tip always in user group settings page.
This commit changes the behavior to show the tip, explaining
which user roles are allowed to edit user groups, to user
with all roles because it is better to show the user which
other roles are allowed to edit. Previously the tip was shown
to non-admin users only.
2021-07-14 14:38:43 -07:00
sahil839 2355e66850 models: Move UserProfile.notification_setting_types to UserBaseSettings.
Since all the notifications settings are defined in UserBaseSettings, we
should shift the notification_setting_types dict to UserBaseSettings.
2021-07-14 14:37:57 -07:00
sahil839 2f386aed0f models: Move UserProfile.property_types to UserBaseSettings.
Since all the display settings are defined in UserBaseSettings,
we should shift the property_types dict to UserBaseSettings.
2021-07-14 14:37:57 -07:00
sahil839 d7dfe80454 models: Add RealmUserDefault table for realm-level default of settings.
This table will be used to store the realm-level default of display
and notification settings for new users.
2021-07-14 14:35:04 -07:00
Tim Abbott a5eb3abc52 css: Fix settings alignment for dialog widget modal. 2021-07-14 13:32:26 -07:00
Tim Abbott c5b455d5c2 dialog_widget: Simplify rendering logic.
This makes the templates a lot more readable.
2021-07-14 13:32:26 -07:00
Tim Abbott e0135e278d dialog_widget: Fix race focusing submit button.
Opening the modal before adding the on_shown handler makes it possible
that the modal could full appear before the handler runs.
2021-07-14 13:32:26 -07:00
Tim Abbott 6fb0d414b4 dialog_widget: Remove is_confirm_dialog variable.
Making the controls declarative makes the system more flexible for
future use cases.
2021-07-14 13:32:24 -07:00
sahil839 fd55df9f7c settings: Use dialog_widget for bot-edit form and remove edit_fields_modal.
This commit changes the bot-edit modal to use dialog_widget instead of
edit_fields_modal.

This commit also removes edit_fields_modal module as it is no longer used.
2021-07-14 13:02:26 -07:00
sahil839 0b21ca725e settings: Use dialog_widget for edit-user-info modal.
This commit changes the edit-user-info modal to use
dialog_widget instead of edit_fields_modal.
The edit_fields_modal module will be removed in
further commits to avoid code duplication.
2021-07-14 13:02:26 -07:00
sahil839 e0ab9e52b5 settings: Use dialog_widget for edit-linkifier modal.
This commit changes the edit-linkifier modal to use
dialog_widget instead of edit_fields_modal.
The edit_fields_modal module will be removed in
further commits to avoid code duplication.
2021-07-14 13:02:26 -07:00
sahil839 f6d8204d23 dialog_widget: Color of button should be according to use of modal.
We show red color for confirmation modals and green for other
modals with input fields.

As of this commit, only confirmation modals use dialog_widget but
some other modals with input fields will be migrated to use
dialog_widget.
2021-07-14 13:02:26 -07:00
sahil839 dff374a48b frontend: Remove html_submit_button paramter passed to dialog_widget.
We used html_submit_button to pass text to be present in the modal
submit button. There are only two possible options as of now -
"Confirm" and "Save changes" and the correct one can be determined
using is_confirm_modal parameter. So, we remove this paramter for
now and we can add it later if we have more type of modals using
this widget.
2021-07-14 13:02:25 -07:00
sahil839 ec3c5547ff frontend: Add dialog_widget module and refactor confirm_dialog.
This commit adds a new dialog_widget.js file containing most
of the code of confirm_dialog.js with some minor changes and
changes confirm_dialog to be a wrapper around dialog_widget.js.
We pass 'is_confim_dialog' as true in dialog_widget for a
confirm_dialog modal. This commit also renames confirm_dialog.hbs
and confirm_dialog_heading.hbs to dialog_widget.js,
dialog_widget.hbs and dialog_widget_heading.hbs respectively.
2021-07-14 12:58:00 -07:00
sahil839 71969f5196 confirm_dialog: Add post_render support in confirm_dialog.
This will be used by other modals when we will migrate
those to use the same code as that of confirm_dialog.
2021-07-14 12:21:24 -07:00
sahil839 c87c4f92ee confirm_dialog: Rename variables and classes used in templates.
This commit renames the variables, functions used in confirm_dialog.js
and classes and ids used in confirm_dialog.hbs.

This change is made so that we can easily migrate edit_fields_modal to
use this same code with some more changes.

We will change the file names and correspondingly import variables in
the next commit.
2021-07-14 12:21:24 -07:00
PIG208 c03b9c95ad request: Store client information using ZulipRequestNotes.
This concludes the HttpRequest migration to eliminate arbitrary
attributes (except private ones that are belong to django) attached
to the request object during runtime and migrated them to a
separate data structure dedicated for the purpose of adding
information (so called notes) to a HttpRequest.
2021-07-14 12:01:07 -07:00
PIG208 26875cdf0b tests: Migrate mocked Request to HostMockRequest.
This migrates some mocked Request class and mocked request achieved
with namedtuple in test_decorators and test_mirror_users to use the
refactored HostMockRequest.

Since weakref cannot be used with namedtuple, this old way of mocking a
request object should be migrated to using HostRequestMock. Only after
this change we can extract client from the request object and store it
via ZulipRequestNotes.
2021-07-14 12:01:07 -07:00
PIG208 8eb2c3ffdb request: Move realm from the request to ZulipRequestNotes. 2021-07-14 12:01:07 -07:00
PIG208 5167a93229 request: Move tornado_handler to ZulipRequestNotes. 2021-07-14 12:01:07 -07:00
PIG208 742c17399e request: Move miscellaneous attributes to ZulipRequestNotes.
This includes the migration of fields that require trivial changes
to be migrated to be stored with ZulipRequestNotes.

Specifically _requestor_for_logs, _set_language, _query, error_format,
placeholder_open_graph_description, saveed_response, which were all
previously set on the HttpRequest object at some point. This migration
allows them to be typed.
2021-07-14 12:01:07 -07:00
PIG208 5475334b16 request: Refactor to store requestor_for_logs in ZulipRequestNotes. 2021-07-14 12:01:07 -07:00
PIG208 3f9a5e1e17 request: Refactor to record rate limit data using ZulipRequestNotes.
We will no longer use the HttpRequest to store the rate limit data.
Using ZulipRequestNotes, we can access rate_limit and ratelimits_applied
with type hints support. We also save the process of initializing
ratelimits_applied by giving it a default value.
2021-07-14 12:01:07 -07:00
PIG208 da6e5ddcae request: Move log_data from HttpRequest to ZulipRequestNotes. 2021-07-14 12:01:05 -07:00
PIG208 75cde8ebcf request: Refactor HostRequestMock to subclass HttpRequest. 2021-07-14 11:52:43 -07:00
PIG208 03693cd27e request: Map HttpRequest to ZulipRequestNotes for typing.
We create a class called ZulipRequestNotes as a new home to all the
additional attributes that we add to the Django HttpRequest object.
This allows mypy to do the typecheck and also enforces type safety.

Most of the attributes are added in the middleware, and thus it is
generally safe to assert that they are not None in a code path that
goes through the middleware. The caller is obligated to do manual
the type check otherwise.

This also resolves some cyclic dependencies that zerver.lib.request
have with zerver.lib.rate_limiter and zerver.tornado.handlers.
2021-07-14 11:52:42 -07:00
Gaurav Pandey 269f6fb577 compose: Fix overlaping expand-compose icon.
The expand-compose icon currently overlaps with the
recipient input field of private message compose box.
Reduce the size of the division to fix overlap.
2021-07-14 11:40:16 -07:00
Gaurav Pandey 5e97ec9ad9 narrow: Do not mark messages as read in mentioned narrow.
The current behaviour marks messages as read when in mentioned
narrow. This is not the ideal behaviour, hence do not mark them
as read.

Fixes #19098.
2021-07-14 11:39:46 -07:00
akshatdalton b0764386bf help: Document the `is:resolved` search keyword. 2021-07-13 23:48:46 -07:00
Tim Abbott 87295dbb8a help: Extend search operator examples to document negation. 2021-07-13 23:48:46 -07:00
akshatdalton 66ba35d7fe search_operators: Add info about `is:resolved` keyword. 2021-07-13 23:48:45 -07:00
akshatdalton 272901326c narrow_banner: Add banner for no resolved topics found search. 2021-07-13 23:36:24 -07:00
akshatdalton fe9693c824 search_suggestion: Add suggestion support for `is:resolved` keyword. 2021-07-13 23:35:41 -07:00
akshatdalton 6a45379a30 resolve topic: Add frontend support for `is:resolved` search keyword/filtering.
This commit adds the frontend support for `is:resolved` search
keyword. Test cases are added for the same.

Fixes: #18990.
2021-07-13 23:18:41 -07:00
akshatdalton f5c4d51ed2 resolve topic: Add `is:resolved` search keyword/filtering support.
This commit adds the backend support for `is:resolved` search keyword.
In the next commit, I will add the frontend support for the same.
2021-07-13 23:18:41 -07:00
akshatdalton 7ec406f39d refactor: Extract `RESOLVED_TOPIC_PREFIX` in topic.py.
This is a prep commit for #18990.
2021-07-13 23:18:41 -07:00
Anders Kaseorg db476bdc51 ci: Use apt-get -y in production-upgrade test.
We currently configure ‘APT::Get::Assume-Yes’ in our custom Docker
image, but this is the only place we rely on it (outside of the
Dockerfile itself), and it’s better not to.

Also ‘apt-get remove && apt-get purge’ is the same as just ‘apt-get
purge’.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-13 18:57:34 -07:00
Abhijeet Prasad Bodas ebb4eab0f9 worker: Rewrite MissedMessageWorker to not be lossy.
Previously, we stored up to 2 minutes worth of email events in memory
before processing them. So, if the server were to go down we would lose
those events.

To fix this, we store the events in the database.

This is a prep change for allowing users to set custom grace period for
email notifications, since the bug noted above will aggravate with
longer grace periods.
2021-07-13 17:21:38 -07:00
Abhijeet Prasad Bodas 1709428cff models: Create MissedMessageEmailEntry table.
This will be used to store the missedmessage events received
during the waiting time for email notifications (which is currently
2 minutes, hardcoded).

The change in `test_retention` is because we've set `on_delete=CASCADE`
for the message field this table.
The new query is like so:
```
DELETE FROM "zerver_missedmessageemailentry"
    WHERE "zerver_missedmessageemailentry"."message_id" IN (
        1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553
        )
```
2021-07-13 17:21:37 -07:00
Abhijeet Prasad Bodas c3319a5231 notification_data: Create common source for trigger strings.
This reduces loose strings in the codebase, and allows us to not worry
about the exact naming (`stream_email_enabled` or `stream_emails_enabled`?)
and tense (`mentioned` or `mention`?).

Ideally this new class should have been in `lib/notification_data.py`,
which is our file for things like this. But, the next commit requires
using this data in `models.py`, and importing from `notification_data.py`
to `models.py` causes recursive imports.
2021-07-13 17:16:32 -07:00
Aman Agrawal a748a2f03c subscription_settings: Improve look of create stream button.
Use the same styling used in send button of compose box.
2021-07-13 16:58:30 -07:00
aryanshridhar 1a3c719967 about_zulip: Indicate the copy icon to be clickable.
Added CSS property of cursor as pointer to the copy
icon in about_zulip section which indicates the
icon to be clickable.

(This minor adjustment was probably missed in a74b52db22)
2021-07-13 16:55:15 -07:00
m-e-l-u-h-a-n 7c0c75b6ca stream settings: Fix scroll issue in subscriber list in stream settings.
As we want subscriber list to occupy rest of available space
in the tab, we use relative units (vh) and calc to set the
max-height property dynamically without losing scroll behavior
for stream list.
2021-07-13 16:50:32 -07:00