Commit Graph

4064 Commits

Author SHA1 Message Date
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
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 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 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
Sahil Batra f97da983cf user_groups: Handle inaccessible streams in group deactivation error.
If the user group being deactivated is used as a setting for a stream
which cannot be accessed by the user trying to deactivate the group,
we show "Unknown stream" in the banner mentioning where the group
is used.
2024-10-01 09:45:37 -07:00
Sahil Batra 58ab97a0b4 user_groups: Show details for group deactivation error.
This commit adds code to list the groups and streams
where the group is being used as settings in a banner.

The banner also mentions if the group is being used for
realm settings.
2024-10-01 09:45:37 -07:00
evykassirer 9ba6c18e3a reload: Only add stream_id if it's defined.
This isn't a bug fix, but it does clean up the code. `reload_setup`
only uses the `stream_id` if it can parse it as an integer and
otherwise falls back to `undefined`, so it makes more sense to not
include undefined stream ids.
2024-09-30 17:48:17 -07:00
evykassirer 261f01ede8 input_pill: Highlight previous pill after backspace deletion.
This is helpful for when a user wants to delete multiple pills
in a row, now that a pill needs to be highlighted before it can
be deleted.

It makes more sense intuitively for the previous pill to be selected
after backspace, since the direction of deletion is backwards. We
still potentially focus next() if there is no previous pill, which
is most helpful when the input element has no more pills left, since
this focuses the text field.
2024-09-30 16:37:12 -07:00
evykassirer 6e85fa8fcc input_pill: Highlight/focus pill before removing it.
Select the pill on the first backspace and delete the whole pill on
the second backspace. If the pill is already highlighted from
left-pressing, then backspace would delete it right away.

We're making this change because it can be quite annoying to
re-type out a pill that's accidentally deleted, and users might
think pills are editable and accidentally delete the whole thing
with a backspace stroke.
2024-09-30 16:37:12 -07:00
evykassirer f5be62f60d buddy_list: Include offline users in participants list for large orgs. 2024-09-30 16:35:13 -07:00
evykassirer 38e5b4b8fc buddy_list: Show conversation participants in the right sidebar.
Fixes #31129.
2024-09-30 16:35:13 -07:00
evykassirer 12033d6690 message_view_header: Add blueslip logging for undefined sub.
To try to figure out why this is happening:
https://chat.zulip.org/#narrow/stream/464-kandra-js-errors/topic/Error.3A.20Failed.20to.20process.20an.20event
2024-09-30 16:32:03 -07:00
Anders Kaseorg 2440c6d244 electron_bridge: Harden against hypothetical DOM clobbering attacks.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-09-30 16:31:27 -07:00
Anders Kaseorg b0653d1ea4 uploaded_files_list: Fix id pollution.
The HTML id attribute is supposed to be globally unique; it’s not an
appropriate place to store a user-controlled string, or to identify
part of a component that’s rendered more than once.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-09-30 14:15:31 -07:00
evykassirer 471d042a11 message_notifications: Convert module to typescript. 2024-09-30 12:07:27 -07:00
evykassirer 6c390551de unread: Remove useless message_unread function. 2024-09-30 12:07:27 -07:00
evykassirer 4215c9d707 message_notifications: Check if NotificationAPI is undefined.
`window.Notification` can be `undefined` in iOS Safari.
https://bugs.webkit.org/show_bug.cgi?id=247315

This hasn't caused any known bugs, but it's better to catch
this case with an undefined check than to assert it's defined
when we convert this file to typescript.
2024-09-30 12:07:27 -07:00
Lauryn Menard d8fd0d8599 scheduled-messages-ui: Set channel ID in narrow term to a string. 2024-09-30 11:25:02 -07:00
Aman Agrawal e5a0157f84 messages_ovelay: Use specific name for `row_item_selector`. 2024-09-30 11:23:29 -07:00
Aman Agrawal e646b3b7b6 messages_overlay: Force specific name for `message-info-box` selector. 2024-09-30 11:23:29 -07:00
Aman Agrawal d2561b778a scheduled_message: Use specific name for `message-info-box` selector. 2024-09-30 11:23:29 -07:00
Aman Agrawal 4a72801091 scheduled_messages: Use specific name for `items_list_selector`. 2024-09-30 11:23:29 -07:00
Aman Agrawal 3f1b78aab9 scheduled_messages: Use specific name for `items_container_selector`.
This avoids selecting an element from hidden other elements having
the same class.
2024-09-30 11:23:29 -07:00
Karl Stolley a8217aee36 lightbox: Treat $original_media_element as singular. 2024-09-30 11:12:40 -07:00
Karl Stolley cad8330988 lightbox: Make selected-media logic less brittle. 2024-09-30 11:12:40 -07:00
evykassirer cd9dc3959a reload: Handle stream messages without specified stream.
The stream id can be undefined when the compose box is open
to start a stream message, but no stream has been selected
from the dropdown yet.

Fixes this error:
https://chat.zulip.org/#narrow/stream/464-kandra-js-errors/topic/Error.3A.20Failed.20to.20preserve.20state/near/1948680

Introduced in 97ffccb45f
2024-09-29 12:21:20 -07:00
Tim Abbott c73462f124 stream_settings: Fix already-subscribed error handling.
This was not correctly migrated in 65893292b5.
2024-09-27 16:51:07 -07:00
Aman Agrawal b6c37a3474 register: Ask which review site for how found zulip. 2024-09-27 13:23:08 -07:00