Commit Graph

6091 Commits

Author SHA1 Message Date
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
Sayam Samal b09dfb782d reactions: Optimize DOM cost of message reactions via dynamic rendering.
Before, the message reactions section along with the add reaction button
was being rendered for every message even when there were no reactions
present - this led to additional DOM cost.

This commit adds the message reactions section only when there is
at least a single reaction on the message, and follows up with a cleanup
of the message reactions section when there are no reactions.

Fixes #31137.

Co-authored-by: Anmol-dev45 <basnetanmol2020@gmail.com>
2024-10-04 11:09:43 -07:00
Sahil Batra 74fb851958 settings: Do not store pill widgets for new groups in map.
Instead of storing setting pill widgets for new groups
in group_setting_widget_map, we just use variable in the
user_group_create file to store the widget.

This helps in accessing the widget with the key having
"new_group_" as prefix which we want to avoid as a pattern.

Note that the classes and IDs in templates still use
"new_group_" prefix.
2024-10-04 08:48:03 -07:00
Sahil Batra 698f3cf41b settings: Refactor code to get group setting pill widget value.
This commit refactors get_group_setting_widget_value function
to accept pill widget as parameter instead of setting name.

This is a prep commit for not needing to store the widgets for
group creation form in settings_components.group_setting_widget_map.
2024-10-04 08:48:03 -07:00
Sahil Batra 4b206b7394 settings: Refactor code to set group setting pill widget value.
This commit refactors set_group_setting_widget_value function
to accept pill widget as parameter instead of setting name.

This is a prep commit for not needing to store the widgets for
group creation form in settings_components.group_setting_widget_map.
2024-10-04 08:48:03 -07:00
Anders Kaseorg 7bd5ec28ae dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-04 08:47:07 -07:00
Anders Kaseorg 7bd0df408d eslint: Fix unicorn/prefer-math-min-max.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-04 08:47:07 -07:00
Anders Kaseorg 3b79a534a2 eslint: Fix unicorn/consistent-existence-index-check.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-04 08:47:07 -07:00
Anders Kaseorg e7e8062b2e web: Add missing CSS.escape calls.
Any string interpolated into a CSS selector must be CSS escaped.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-04 08:39:30 -07:00
Anders Kaseorg a8304fb324 sentry: Address Sentry JavaScript 7.x deprecations.
https://docs.sentry.io/platforms/javascript/migration/v7-to-v8/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-03 16:09:48 -07:00
Aman Agrawal 1b47134d0d sponsorship: Fix `#organization-type` not found.
The sponsorship form is not visible once user submits the form,
hence we don't to call these functions.
2024-10-03 09:25:47 -07:00
Anders Kaseorg 9c2da46966 filter: Fix unparse to round-trip Unicode whitespace operands.
Previously [{operator: "topic", operand: "one\xa0two"}] would be
unparsed to "topic:one\xa0two" which parses as [{operator: "topic",
operand: "one"}, {operator: "search", operand: "two"}], leading to
exceptions in the search pill system.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-10-03 09:14:31 -07:00
roanster007 81efecf463 stream_topic_history: Update history to only store acked message ids.
Previously, the "stream_topic_history" used to store unacked float
message ids as well in its "max_message_id" of stream and
"message_id" of topic histories.

This commit updates it to rather store only the acked message ids
here, and rather use the "echo_state" module so as to look up
for unacked messages in case of looking for recent topics, or
max message id in functions.
2024-10-02 18:31:32 -07:00
roanster007 da75fed5be echo: Start tracking local messages before updating sidebars.
Previously, when `insert_local_message` was called, the
data structures in the `echo_state` are updated with the new
local messages after calling `insert_new_message`. This would
update the stream sidebar before even updating the `echo_state`
with the new local messages.

This commit introduces `track_local_message`, which basically
updates the `echo_state` data structures with the local
message before actually updating the stream sidebar.

This is a preparatory commit to update stream_topic_history
to only contain acked message ids.
2024-10-02 18:31:32 -07:00
Tim Abbott 3f307f5941 message_view_header: Remove unnecessary complexity.
The narrow_state module has a function that returns what this needs.

This does remove a log statement, but I don't think it was useful; we
don't need to or have a useful way to colorize a channel that doesn't
exist.
2024-10-02 17:42:02 -07:00
roanster007 359ebfc6c8 filter: Refactor code path which adjusts the narrow containing `with`.
This commit refactors the `ensure_channel_topic_terms` of filter.ts.
Previously, this method used to add channel and topic terms, with
operands as placeholders in case the `with` narrow doesn't have
channel-topic terms.

This commit updates it to rather correct the narrow with the right
terms in case the channel-topic terms are missing in the `with`
narrow, but leave it as it is in case the channel-topic terms are
present, so that it can later be corrected if the channel-topic
terms are not pointing to the right conversation.
2024-10-02 16:22:59 -07:00
Sayam Samal 0a9ae964fe send_later_popover: Improve on-focus styling of enter send choices.
Previously, no custom styling was being applied to the enter send
choice options, which led to uneven styling from the other popover
options, as well as the outline ring being cut-off from the edges of
the popover. This commit fixes these issues by adding custom styling
for the outline ring when the enter send choice options are focused.
2024-10-02 14:35:37 -07:00
Sahil Batra e19f4ed2a8 user_groups: Do not allow click events on disabled pill container.
The typeahead should not open on clicking the pill container when
the container is disabled when the user is not allowed to change
the setting.
2024-10-02 14:23:37 -07:00
evykassirer 9c8cc8c333 buddy_data: Add participants to the top of sorted user list.
This was causing a bug where the participants weren't necessarily
all getting rendered, specifically when there were many subscribers
to a channel, because we render users in batches as buddy list
scrolls, and those users would only show up after some scrolling.

This fix makes sure we always load the participants first.
2024-10-02 09:33:48 -07:00
Aman Agrawal 8e5672dd98 message_view: Fix narrow to compose recipient rerenders in same narrow.
We don't rerender if we are already narrowed to the compose recipient.
2024-10-02 09:32:18 -07:00
opmkumar ee70cd8af3 saved_snippet: Prepopulate new saved snippet content.
Fixes #31827.
2024-10-02 09:30:18 -07:00
Tim Abbott 2807d7fbb8 dropdown_widget: Use CSS variable for disable color. 2024-10-01 18:21:33 -07:00
Tim Abbott 119fa699a7 message_view: Fix invalid target message assumption.
The target_message is just whatever message has the ID in a /near/ or
/id/ link; there's no guarantee it's a channel message.
2024-10-01 17:59:59 -07:00
Tim Abbott 0fa4cd9d09 message_view: Remove incorrect assert for p keyboard shortcut.
This happens routinely when the current view is not a DM view.
2024-10-01 17:47:45 -07:00
Shubham Padia 12ebd97f1f settings: Add group_creator as default for can_manage_group.
We create an unnamed user group with just the group creator as it's
member when trying to set the default. The pattern I've followed across
most of the acting_user additions is to just put the user declared
somewhere before the check_add_user_group and see if the test passes.
If it does not, then I'll look at what kind of user it needs to be set
to `acting_user`.
2024-10-01 17:35:14 -07:00
Shubham Padia 91edf59873 settings: Rename can_edit_all_user_groups to use `manage`.
Having both `manage` and `edit` terminologies was confusing, so
this commit ensures that we use `manage` wherever applicable.
2024-10-01 17:35:14 -07:00
Shubham Padia b7764eb6f0 settings: Remove user_group_edit_policy from the frontend. 2024-10-01 17:35:14 -07:00
Shubham Padia f0b9d610a5 settings: Use `can_manage_all_groups` to control who can manage groups.
We also add the exception for the group creator to be able to edit their
group in this commit. This exception was added in the backend in earlier
commits.
2024-10-01 17:35:14 -07:00
Shubham Padia 2b6414acfb settings: Add can_manage_all_groups setting to realm.
This commit does not add the logic of using this setting to actually
check the permission on the backend. That will be done in a later
commit.
Only owners can modify this setting, but we will add that logic in a
later commit in order to keep changes in this commit minimal.
Adding the setting breaks the frontend, since the frontend tries to find
a dropdown widget for the setting automatically. To avoid this, we've
added a small temporary if statement to `settings_org.js`.
Although, most lists where we insert this setting follow an unofficial
alphabetical order, `can_manage_all_groups` has been bunched together
with `can_create_groups` since keeping those similar settings together
would be nicer when checking any code related to creating/managing a
user group.
2024-10-01 17:35:14 -07:00
Shubham Padia a9e14a184c settings: Use `can_create_groups` to control who can create user groups. 2024-10-01 17:35:14 -07:00
Shubham Padia 17276e95a1 dropdown_widget: Allow passing is_setting_disabled in the template.
This is a preparatory commit to allow disabling
dropdown_widget_with_label for `can_create_groups` and
`can_manage_all_groups` for non-owners.
2024-10-01 17:35:14 -07:00
Shubham Padia fc46673f23 settings: Add can_create_groups setting to realm.
This commit does not add the logic of using this setting to actually
check the permission on the backend. That will be done in a later
commit.

Adding the setting breaks the frontend, since the frontend tries to find
a dropdown widget for the setting automatically. To avoid this, we've
added a small temporary if statement to `settings_org.js`.
2024-10-01 17:35:14 -07:00
Vector73 66113365a5 saved_snippets: Add new feature for saved snippets.
Fixes #31227.
2024-10-01 11:48:15 -07:00
Lauryn Menard 8301dcd421 compose-recipients: Resize compose box text area for placeholder.
When adding or removing recipients for a direct message, the
placeholder text may cause a change in the size of the compose box,
so this adds a call to `compose_ui.autosize_textarea` when setting
that placeholder attribute.
2024-10-01 10:29:16 -07:00
Tim Abbott 2f8e2f77aa user_group_edit: Fix use of stream in user-facing string. 2024-10-01 10:25:59 -07:00