Commit Graph

6225 Commits

Author SHA1 Message Date
evykassirer 897f605acf settings_components: Generate StreamSettingProperty type from a schema.
This will be useful for later when we'll need the schema for
converting settings_org to typescript.

This commit also renames StreamSettingProperty to more accurately
reflect the type of a single property key.
2024-10-14 15:33:01 -07:00
evykassirer c133f7f219 sub_store: Generate StreamSubscription type from a schema.
This will be useful for later when we'll need the schema for
converting settings_org to typescript.
2024-10-14 15:33:01 -07:00
evykassirer 905a234966 settings_components: Generate RealmUserSettingDefaultProperties from schema.
This will be useful for later when we'll need the schema for
converting settings_org to typescript.
2024-10-14 15:33:01 -07:00
evykassirer 67f4866201 settings_components: Generate RealmSettingProperty type from a schema.
This will be useful for later when we'll need the schema for
converting settings_org to typescript.

This commit also renames RealmSettingProperty to more accurately
reflect the type of a single property key.
2024-10-14 15:33:01 -07:00
evykassirer 69db3c422a settings_org: Remove get_widget() call and use equivalent `this`.
Manually verified here: https://github.com/zulip/zulip/pull/31940#discussion_r1798533802
2024-10-14 15:33:01 -07:00
evykassirer 808c24aef2 typescript: Convert some && constructions to optional chains.
Some upcoming changes to how types are constructed are going
to bring up these type linter errors, so fix them now.
2024-10-14 15:33:01 -07:00
evykassirer e5dd75baf0 buddy_list: Differentiate updating and changing to an undefined filter.
Followup to #31960. I forgot to consider the case of a narrow with
an undefined filter. To make sure we fully run render_section_headers
on narrows like Recent Conversations the first time they load, this
commit initializes `current_filter` to the string "unset".
2024-10-14 15:15:26 -07:00
Lauryn Menard 3e3ca26aae docs: Update keyboard shortcuts to always show "Fn" key option.
Previously, these were only shown for Mac OS users and replaced
the "Home", "End", "PgUp" and "PgDn" shortcuts. But as this really
depends on the keyboard the user is using (there are Mac keyboards
with the above keys), we instead show both options in our web app
and help center documentation on keyboard shortcuts.

The tooltip for the "Scroll to bottom" button will now always show
"End" for all users. Previously, it showed a "Fn" key option for
Mac users.

Fixes #31815.
2024-10-14 15:14:10 -07:00
Lauryn Menard 93c172ee3f message-fetch: Add spectator term when building narrow parameter.
Again, since the spectator term is added to the narrow parameter
for all views, then we consolidate that logic when building the
initial narrow data.
2024-10-14 15:11:41 -07:00
Lauryn Menard 7289d43f74 message_fetch: Simplify building narrow data.
If page_params.narrow is defined, then it is added to the narrow
parameter (whether it is the home view or not), so here we
consolidate that logic.
2024-10-14 15:11:41 -07:00
Lauryn Menard 09bce62d98 messsage-fetch: Convert channel operator's operand to integer ID.
The operand for the canoncial "channel" operator can be an ID, but
it must be an integer and not a string, so we take care of that
directly in handle_operators_supporting_id_based_api.
2024-10-14 15:11:41 -07:00
Lauryn Menard 3405e95b6b message-fetch: Use canonical operator for ID based API updates.
Updates handle_operators_supporting_id_based_api to use the
canonical operator when updating the narrow parameter to use
object IDs.
2024-10-14 15:11:41 -07:00
Lauryn Menard 62c2f35995 message-fetch: Refactor handle_operators_supporting_id_based_api.
Instead of updating the object with all of the parameters for the
message fetch, we only update the narrow parameter.
2024-10-14 15:11:41 -07:00
Varun Singh 697e7acaaa scheduled_messages_ui: Convert module to TypeScript. 2024-10-14 13:35:11 -07:00
Shubham Padia b3d75d619a help: Consistently name restrict email setting.
Remove question mark.
See https://chat.zulip.org/#narrow/channel/101-design/topic/name.20permissions.20settings.20consistently/near/1959774
2024-10-14 13:30:01 -07:00
Shubham Padia 588f609a9c help: Consistently name unsubscribe channel setting.
Remove question mark.
See https://chat.zulip.org/#narrow/channel/101-design/topic/name.20permissions.20settings.20consistently/near/1959774
2024-10-14 13:30:01 -07:00
Shubham Padia d7d3da6f9f help: Consistently name channel post setting.
Remove question mark and replace `the` with `this`.
See https://chat.zulip.org/#narrow/channel/101-design/topic/name.20permissions.20settings.20consistently/near/1959774
2024-10-14 13:30:01 -07:00
Shubham Padia 2f7dcfae7b help: Consistently name access channel setting.
Remove question mark and replace `the` with `this`.
See https://chat.zulip.org/#narrow/channel/101-design/topic/name.20permissions.20settings.20consistently/near/1959774
2024-10-14 13:30:01 -07:00
Shubham Padia 065703c779 help: Consistently name mention group setting.
Remove question mark.
See https://chat.zulip.org/#narrow/channel/101-design/topic/name.20permissions.20settings.20consistently/near/1959774
2024-10-14 13:30:01 -07:00
Shubham Padia 797438b0f7 user_groups: Allow setting and changing can_leave_group setting.
Fixes #31951.
2024-10-14 11:44:27 -07:00
Shubham Padia 1862c3b333 user_groups: Use can_leave_group setting to check permisison.
This commit adds code to use can_leave_group setting when
checking permission to leave group in webapp.
2024-10-14 11:44:27 -07:00
Sahil Batra 6007630164 user_group_edit: Fix update_group function.
This commit fixes the mistakes made during rebase in
96abf2501a and 9bbd6a7316.
2024-10-14 10:06:17 -07:00
Vector73 f733ab112c settings: Add `can_add_custom_emoji_group` realm setting.
Added `can_add_custom_emoji_group` setting to replace `add_custom_emoji_policy`.
2024-10-13 16:09:04 -07:00
Prakhar Pratyush 723346b05c settings_exports: Add 'Type' column to data exports table.
This commit adds a 'Type' column to the Data exports table
in the org settings.

It specifies whether it's a public data or standard export.

Fixes part of #31201.
2024-10-11 17:38:17 -07:00
Prakhar Pratyush 6e7cb8a8c4 settings_export: Add modal to select export_type before starting export.
This commit adds a modal which offers a way to select export_type
before making a POST request to start export.

Fixes part of #31201.
2024-10-11 17:38:17 -07:00
evykassirer 478cd9220c buddy_list: Refactor menu popover to support keyboard navigation. 2024-10-11 17:26:57 -07:00
evykassirer 88ae87c10f buddy_list: Use user_sidebar_entry selector instead of li. 2024-10-11 17:26:57 -07:00
Prakhar Pratyush 3314c89288 realm: Add maximum file size upload restriction.
This commit adds a restriction to the maximum file size
that can be uploaded to a realm based on its plan_type.
2024-10-11 17:16:48 -07:00
Prakhar Pratyush 808acc9e47 events: Migrate plan_type & upload_quota to update_dict event format.
'realm_upload_quota_mib` is updated when `plan_type` changes.

Earlier, we were including 'upload_quota' to update
`realm_upload_quota_mib` in extra_data field of 'realm op: update'
event format when property='plan_type'.

This commit migrate those two parameters to `realm op: update_dict`
event format.

* None of the clients processes these fields, so no compatibility
  code required.
* Renamed `upload_quota` to `upload_quota_mib` as it better aligns
  with our goal to encode units in the client-facing API names.
  Also, it helps to avoid extra code to update 'realm_upload_quota_mib`
  in web client, web client simply aligns with
  'realm["realm_" + key] = value'.
2024-10-11 17:16:48 -07:00
Lauryn Menard d3987f611c urls: Generate narrow links in frontend with "channel" operator.
Fixes #30385.
2024-10-11 17:00:23 -07:00
Aman Agrawal 592afffab4 message_events: Fix messages missing in combined feed.
When combined feed is cached, moving messages can cause some
messages to be missing.

This can be reproduced by moving messages from a muted stream to
non muted stream.

Fixed by updating all rendered message lists for the messages
that were moved.
2024-10-11 16:38:44 -07:00
Shubham Padia c9d5276031 user_groups: Set can_manage_all_groups to administrator group.
Earlier we use to restrict admins, moderators or members of a group to
manage that group if they were part of the realm wide
`can_manage_all_groups`. We will not do that anymore and even
non-members of a group regardless of role can manage a group if they are
part of `can_manage_all_groups`.

See
https://chat.zulip.org/#narrow/stream/101-design/topic/Group.20add.20members.20dropdown/near/1952902
to check more about the migration plan for which this is the last step.
2024-10-11 16:31:18 -07:00
Shubham Padia 9bbd6a7316 user_groups: Check can_add_members_group when adding members.
Fixes #25942.
Users with permission to manage the group (either on the group level or
realm level) should be able to add members to the group without being
present in can_add_members_group.
2024-10-11 16:31:18 -07:00
Shubham Padia 8a2a8b64aa user_groups: Add can_add_members_group field to group create/edit. 2024-10-11 16:31:18 -07:00
Sahil Batra 553409c1ca settings_profile_fields: Move computations out of ListWidget code.
This commit moves the code to compute the profile field order and
the number of fields shown is user card, out of the list_widget
functions just to maintain the code readability and keeping code
easy to understand.
2024-10-11 16:17:06 -07:00
tnmkr 8af4366cc0 custom_profile_fields: Update admin table empty placeholder message.
Fixes #27250.
2024-10-11 16:17:06 -07:00
tnmkr 2c8b1adc5f custom_profile_fields: Migrate admin table to use ListWidget.
ListWidget will allow us to use our standard structure for empty table
placeholder.

This is a prep commit for #27250.
2024-10-11 16:17:06 -07:00
Prakhar Pratyush 55f97cd06f realm_export: Add support to create full data export via /export/realm.
Earlier, only public data export was possible via `POST /export/realm`
endpoint. This commit adds support to create full data export with
member consent via that endpoint.

Also, this adds a 'export_type' parameter to the dictionaries
in `realm_export` event type and `GET /export/realm` response.

Fixes part of #31201.
2024-10-11 13:20:42 -07:00
evykassirer 2367c46455 buddy_list: Fix bug where headers weren't being updated often enough.
`$(".buddy-list-subsection-header").children()` has length more often
than I had thought. Using the narrow filter is more direct way of
managing this state.
2024-10-11 13:16:45 -07:00
evykassirer d61ec2a0cc settings: Remove unused realm_create_private_stream_policy.
This was replaced with realm_can_create_private_channel_group in
e19524b and wasn't fully removed.
2024-10-11 13:15:36 -07:00
evykassirer 87835b81cb state_data: Flesh out types for realm_schema. 2024-10-11 13:02:45 -07:00
Karl Stolley 979e8ff5d2 inbox: Use plural for Direct messages header. 2024-10-11 12:54:21 -07:00
Kislay Udbhav Verma 8b7820ca71 resolve_topic: Change dialog button text.
We replace the comma in the buttons to an em dash.
This is a follow up to #31312.
2024-10-11 11:49:18 -07:00
Sahil Batra 7db6de340f settings: Clean schemas and types used for group settings.
Removed "type"/"Type" from schema and type names used
for group settings because we want to use "type"/"Type"
only for "type of a type" cases.

So, this commit renames-
- anonymous_group_type => anonymous_group_schema
- group_setting_type_schema => group_setting_value_schema
- GroupSettingType => GroupSettingValue

We also had duplicate definitions for GroupSettingType, in
state_data.ts and in settings_components.ts. So, removed it
from settings_components.ts.
2024-10-11 11:22:47 -07:00
Sahil Batra 96abf2501a user_groups: Handle live-update of group settings like other settings.
This commit updates live-update of group settings like we do for
stream and realm settings.

Current behavior is -
- If the save discard buttons are visible, meaning that the current
user was in the middle of changing a setting, then all the settings
elements are synced to the original value irrespective of whether
that setting was actual updated, including the setting which the
current user was changing.
- If the save discard buttons are not visible, then only the
element of updated setting is synced as it is not needed to
reset the UI for other settings.

We make the change similar to what we did for realm and stream
settings in 5da1e57fc2. 5da1e57fc2 did not had the changes
for group settings since we had only one group setting then
but now we have multiple settings.
2024-10-11 11:21:56 -07:00
Sahil Batra d7ad951172 settings_components: Compare group setting values correctly.
Since group setting value can be an object containing
direct_members and direct_subgroups fields, this code
updates check_group_property_changed function to use
isEqual to compare the setting values instead of using
"===".

This makes sure that save-discard widget is shown and
hidden as expected.
2024-10-11 11:21:56 -07:00
evykassirer 36183761f8 settings_notifications: Add specificity to select classname to justify type. 2024-10-10 14:36:07 -07:00
evykassirer 9dc0e55835 settings_notifications: Convert module to typescript. 2024-10-10 14:36:07 -07:00
evykassirer daf9954c8b notifications: Add specificity to notification_sound_elem.
This will help justify upcoming types in settings_notifications.ts
2024-10-10 14:36:07 -07:00
evykassirer 52b33868f1 settings_notifications: Pass currentTarget instead using e.target.
This function only uses `e` for its `target`, so it could instead be
passed the `HTMLInputElement` instead of the `JQuery.ChangeEvent`. The
caller is an event handler for the selector `"input, select"` and
`<input>` has no children, so there’s no difference here between
`.target` and `.currentTarget`.

This will be helpful for typescript, because `currentTarget` has
clearer typing.
2024-10-10 14:36:07 -07:00
evykassirer b5352df782 ui_util: Fix elem type in play_audio to match how it's called. 2024-10-10 14:36:07 -07:00
evykassirer faeee04472 settings_notifications: Initialize user_settings_panel to undefined instead of {}.
This will make the conversion to typescript easier.
2024-10-10 14:36:07 -07:00
evykassirer 9ee489700b buddy_list: Move invite users link to inside scrollable section.
Fixes #31653 (second half).
2024-10-10 14:34:11 -07:00
evykassirer 33cbaf598a buddy_list: Add three dot menu beside search button, with invite link.
Fixes part of #31653.
2024-10-10 14:34:11 -07:00
evykassirer 0dedd00112 buddy_list: Add span for search section of header.
This is in preparation for adding a three-dot menu to the header,
which we don't want to be a click/hover target in the way the
search parts are.
2024-10-10 14:34:11 -07:00
evykassirer 17252a70ed buddy_list: Un-nest menu icon styles, for ease of sharing. 2024-10-10 14:34:11 -07:00
Varun Singh f4de1c4313 personal_menu_popover: Convert module to TypeScript. 2024-10-10 14:07:57 -07:00
Varun Singh 9d2a82d477 personal_menu_popover: Remove unused field from function call.
The API structure does not contain the `user_id` field.
2024-10-10 14:07:57 -07:00
Aman Agrawal ec23f5e77b hello: Add interactive block showing basic usage.
Co-Authored-By: Vlad Korobov <terpimost@gmail.com>
2024-10-10 11:42:29 -07:00
Sahil Batra 7b27948518 user_groups: Live update members list if a member is deactivated. 2024-10-10 11:37:44 -07:00
Sahil Batra 4fe12c1860 user_group_settings: Remove redundant is_person_active check.
The "members" field for user groups sent by servers only include
active users, so there is no need for is_person_active check to
filter out the deactivated users.
2024-10-10 11:37:44 -07:00
Karl Stolley bef66b7c40 starred_messages: Match header to left-sidebar icon. 2024-10-10 11:26:46 -07:00
Kislay Udbhav Verma a787c7ff80 topic: Add a first-time explanation for "Resolve topic".
We show a confirmation dialog explaining the "resolve topics"
feature when the user marks a topic resolved for the first time.
If the user confirms the action, we mark the
topic resolved, else we don't.

We don't show anything the first time a topic is marked
unresolved.

Fixes #31242
2024-10-09 18:12:55 -07:00
Sayam Samal e0d685ce92 message: Improve the copy codeblock and playground buttons.
This commit improves the copy codeblock button and playground button
in the codeblocks to improve their visibility, particularly when on
top of some code.

Previously, the text under these buttons was difficult to select, as the
buttons would block the selection. This commit now hides these buttons
when a user clicks on any part of the codeblock, allowing to view the
code without any distractions, as well as, allowing the user to select
any part of the code.
2024-10-09 17:37:08 -07:00
Anders Kaseorg ca8d25f830 tests: Unmock realm_user_settings_defaults.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 16:33:38 -07:00
Anders Kaseorg a2c4e3a220 tests: Use override for realm_user_settings_defaults.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 16:33:38 -07:00
Anders Kaseorg ddf0fafab7 tests: Use override more for realm.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 16:20:50 -07:00
Anders Kaseorg e84bb9ff2c tests: Unmock state_data.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 95153b3f0c tests: Use override for realm.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 9cd2408e0d tests: Use override for current_user.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 8e49ca163b tests: Unmock user_settings.
We previously auto-mocked this out of expediency, but that made it
impossible to test anything that uses the Zod schemata in the same
module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Anders Kaseorg 4d74ecccf3 tests: Use override for user_settings.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-09 15:34:58 -07:00
Karl Stolley 1f2ce2e7e6 left_sidebar: Use calendar-days icon with scheduled messages. 2024-10-09 11:14:27 -07:00
Sayam Samal 2e0cd48141 popovers: Fix initial focus on popover simplebar container.
This commit is a follow-up of 43eebbf9c6,
and it sets `data-simplebar-tab-index="-1"` on the remaining popovers.

This prevents the simplebar container from taking focus while trying to
navigate the popovers via the keyboard, thus fixing the bug where the
user had to click the down key twice before reaching the first
focus-able popover menu option.
2024-10-09 11:13:17 -07:00
Tim Abbott a1d616f8c0 upload: Disable the tus-js-client fingerprinting feature.
This feature isn't likely to be useful for our use case and generates
some risk; see the comment for details.
2024-10-08 18:04:24 -07:00
evykassirer 6c62ce567f setting_org: Remove unused params sent to build_realm_icon_widget. 2024-10-08 17:52:15 -07:00
evykassirer dd0b5b56c2 settings_org: Explicitly pass undefined for missing sub argument. 2024-10-08 17:52:15 -07:00
evykassirer efe8c4754b settings_org: Use this instead of e.target.
This should work because all the events are either `change` events or
`click` events on elements without children. This change is being made
to make typescript migration easier, ecause we can type `this` more
easily than `e.target`.
2024-10-08 17:52:15 -07:00
evykassirer 0f1f42f3a5 settings_org: Add default value for null realm_jitsi_server_url. 2024-10-08 17:52:15 -07:00
evykassirer 0c29e067b4 buddy_list: Rotate the header triangle when collapsing a section. 2024-10-08 17:41:30 -07:00
evykassirer 4adf6e6c1e buddy_list: Don't rerender whole header when toggling sections.
This will be necessary to get the triangle to rotate when toggled.
2024-10-08 17:41:30 -07:00
evykassirer 83dc7fc4d9 typeahead: Prevent blue styling from mouse hover on typeahead item. 2024-10-08 17:36:40 -07:00
Anders Kaseorg ba8b9a445b eslint: Fix unicorn/prefer-node-protocol.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-08 16:54:15 -07:00
Anders Kaseorg 9c2f38193d stream_data: Always initialize pin_to_top.
This simplifies the StreamSubscription type, and parallels how we
always initialize every other property that isn’t in
NeverSubscribedStream (audible_notifications, desktop_notifications,
email_notifications, push_notifications, wildcard_mentions_notify,
color, is_muted).  email_address was already optional.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-08 16:52:42 -07:00
Sahil Batra 7a1277ea95 user_groups: Allow setting and changing can_join_group setting.
Fixes part of #25938.
2024-10-08 12:18:13 -07:00
Sahil Batra 701e391def user_groups: Use can_join_group setting to check permisison.
This commit adds code to use can_join_group setting when
checking permission to join group in webapp.

Fixes part of #25938.
2024-10-08 12:18:13 -07:00
Sahil Batra 1033230b52 user_groups: Include "can_join_group" field in user group objects.
Fixes part of #25938.
2024-10-08 12:18:13 -07:00
Karl Stolley a073eaa534 left_sidebar: Use unfilled star icon in sidebar navigation. 2024-10-08 10:43:28 -07:00
Aman Agrawal 777f6be88f puppeteer: Fix incorrectly passed `false` value to check narrow change.
This caused another CI flake.

Also, added a comment to the only other place where we pass false
explicitly explaining why.
2024-10-07 16:07:08 -07:00
Karl Stolley 3209086370 widgets: Assign zulip-button colors to edit buttons. 2024-10-07 13:57:20 -07:00
Aman Agrawal d5b8193a0a hashchanged: Fix near links being ignored if already in that view.
Fixes #31701.

This fixes a bug where when the user clicks on a near link, the
pointer doesn't shift to the `near` linked message. This can
be a confusing experience for the user.
2024-10-07 11:06:58 -07:00
Aman Agrawal 787a37176d message_view: Update date on sticky header after rendering narrow.
On a fresh render of a narrow if the view doesn't scroll,
`update_sticky_recipient_headers` is not called. So, we need call
it after we have scrolled to the message we want to select.
2024-10-07 11:02:13 -07:00
Aman Agrawal 69c1b7c64e message_events: Use the new message_ids param of /messages.
This helps us better update the views where we don't have the
messages that were updated cached or the filter cannot be
applied locally.

Tested using browser breakpoints for search `zulip` in starred narrow
for `!filter.can_apply_locally()` and setting message_fetch
constants to single digit for `messages_to_fetch.length > 0`.
2024-10-07 11:00:40 -07:00
Aman Agrawal 334a195627 message_events: Fix property_value not being passed.
This was not passed by mistake.
2024-10-07 11:00:40 -07:00
Aman Agrawal dae2a68ad9 puppeteer: Fix flaky wait for narrow change after sending a message.
This flake was happening since `wait_for_fully_processed_message`
only checks if the `star` icon is displayed on the message but
doesn't check for current narrow or waits for the narrow to
change.

Since narrow is changed to the message narrow after sending a
message. If we don't wait for narrow to change, this narrow change
can make the `get_current_msg_list_id` call return true for the
wrong narrow change. Which causes message list id of the wrong
message list to be returned and hence we cannot locate this
message list id.

To fix it, we check if sending this message will cause a narrow
change and if true, we wait for the narrow to change before
checking if the message is visible.
2024-10-07 14:17:02 +05:30
Aman Agrawal 882e4f56c1 copy-and-paste: Remove not required click on all messages narrow.
This change might also fix the flaky nature of this test but needs
to be tested by running online on CI.
2024-10-07 08:27:10 +05:30
Aditya Kumar Kasaudhan 8994266137 left-sidebar: Use -, _, :, and / as additional topic word separators.
Previously, only spaces were used as word separators when searching
for topics. This meant that searching for "support" would not find a
topic named "topic_support" or "topic/support," which could lead to
unexpected results.

To address this, hyphen (-), underscore (_), colon (:), and slash (/)
have been added as additional word separators for topic filtering in
the left sidebar, as these characters are commonly used as separators
in topic names.

Fixes: #31844
2024-10-04 14:18:43 -07:00
Shubham Padia 6968d7374a compose: Change cursor to default instead of not-allowed.
Fixes #31214.
2024-10-04 11:40:15 -07:00
Shubham Padia 0634f75582 settings: Rearrange group settings in alphabetical order. 2024-10-04 11:15:01 -07:00
Shubham Padia 72de37e737 settings_data: Move spectator check to a single function.
Move spectator check to user_has_permission_for_group_setting.
2024-10-04 11:15:01 -07:00