Commit Graph

1839 Commits

Author SHA1 Message Date
Shubham Padia
7eb9c9deef Groups: Can perform any join, leave, add, remove for deactivated group.
Fixes #33804.

We still do not allow permission settings to be set to deactivated
groups.
2025-06-11 14:58:14 -07:00
Sahil Batra
32287a084b channel-folders: Add UI to create new channel folder.
This commit adds a button besides the folder dropdowin in
stream settings UI which can be used to create a new folder.
2025-06-10 11:51:58 -07:00
Sahil Batra
7c01e61e5a streams: Add UI to add or remove stream from a folder.
This commit adds UI to add a stream to a folder while
creating them and also for adding/removing an existing
stream from a folder.
2025-06-10 11:51:58 -07:00
Sahil Batra
403b73e1a6 channel_folders: Add support for channel folders in webapp.
This commit adds code to handle channel folders data in
webapp.
2025-06-10 11:51:58 -07:00
Sahil Batra
e643d7e6fd dropdown-list-widget: Allow customization for "Disable" option.
We currently always show fa-ban icon and "Disable" text for
"Disabled" or "None selected" option in dropdown-list widget.

This commit adds code to provide an option for not showing the
fa-ban icon and having the option text be something other than
"Disable". This will be used in channel folder dropdown widget
where we want to have "None" text in the option without icon.
2025-06-10 11:51:58 -07:00
apoorvapendse
3cd0f87d47 draft_overlay: Clarify the editing UI for drafts.
Co-authored-by: Sayam Samal <sayam@zulip.com>
Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-06-10 11:08:35 -07:00
Shubham Padia
3dc54a10d7 filter: Do not set anchor as first_unread for starred messages view.
Fixes
https://chat.zulip.org/#narrow/channel/9-issues/topic/Starred.20messages.20view.20performance/near/2184251.
Anchor for starred messages was `first_unread` and the query to find
first_unread in a user's starred messages can turn out to be expensive.
This commit ensures that we default to newest instead since first_unread
is not of important for the starred messages view.
By excluding starred messages from using `first_unread`, it will default
to newest based on the logic in message_view.ts.
2025-06-09 16:21:09 -07:00
Saubhagya Patel
5f164582a4 settings: Add channel notifications customization in Personal settings.
This commit adds an option to change the notification settings
of a channel from default to custom in the Notifications menu
of Personal settings.

Fixes #19849.
2025-06-09 13:50:55 -07:00
Saubhagya Patel
45f38795e9 settings: Add push_notifications_disabled in notification checkboxes.
This commit adds a variable `push_notifications_disabled` to the
checkboxes used in the notifications table in Settings > Notifications.
The variable is used to control the mobile push notifications
disabled tooltip.
2025-06-09 13:50:55 -07:00
Evy Kassirer
d1023660da search_pill: Prevent adding duplicate search pills.
We shouldn't show duplicate suggestions in the typeahead, but
duplicate pills were still possible by typing a term twice in
the search bar and pressing enter after each one, and this
commit prevents that from putting duplicate pills in the search
bar.
2025-06-07 22:59:14 -07:00
Evy Kassirer
f0210fd6e8 search_suggestion: Prevent duplicate terms in default suggestion. 2025-06-07 22:59:14 -07:00
Evy Kassirer
fa03c42009 search: Show correct description string for public channels.
Previously, typing "channels: public" would show "Channels public"
in the typeahead, which was especially confusing because we'd show
"All public channels" until the term was completely typed out.
2025-06-06 18:04:48 -07:00
Tim Abbott
bbeede1e52 people: Optimize is_person_active.
Calling settings_data.user_can_access_all_other_users on every call to
this function could be expensive when using this function in loops
over every user in the organization.

After the previous commit, those calls are still somewhat expensive
for guest users.
2025-06-06 10:53:03 -07:00
Tim Abbott
446ba1b538 settings_data: Optimize user_can_access_all_other_users.
This fixes an important issue where this function being called in a
loop can consume as much as 1ms per iteration for users who are in a
lot of groups.
2025-06-06 10:53:03 -07:00
Shubham Padia
7b925ce94a buddy_list: Set html instead of append for view all subscribers link.
Earlier, we were appending view all subscribers link using
JQuery.append, which leaves open the possibility for the component to
be appended multiple times if the function calling it gets called
multiple times.
It is better to have the link div in right_sidebar.hbs
and then insert the html when required.
2025-06-05 16:13:07 -07:00
Shubham Padia
90a1f0f7aa buddy_list: Set html instead of append for view all users link.
Fixes https://chat.zulip.org/#narrow/channel/9-issues/topic/buddy.20list.20view.20all.20users.20appears.20twice
Earlier, we were appending view all users link using JQuery.append, so
when `render_view_user_list_links` is called twice, `view all users`
appears twice. It is better to have the link div in right_sidebar.hbs
and then insert the html when required.
2025-06-05 16:13:05 -07:00
Evy Kassirer
b31d3ce5b9 search_suggestion: Canonicalize search text terms before suggesting.
Fixes bug reported here
https://chat.zulip.org/#narrow/channel/9-issues/topic/search.20typeahead.20duplicates.20.22sent.20by.20me.22/near/2183976
2025-06-05 16:10:02 -07:00
Evy Kassirer
b63b4a26c8 filter: Don't lowercase search operands.
Searching e.g. "NASA" would put "nasa" in the search bar if you
selected "search for NASA" in the typeahead. This probably looks
weird to users, so let's not lowercase search operands.
2025-06-05 16:10:02 -07:00
Aditya Kumar Kasaudhan
a5632a9356 drafts: Refactor draft deletion to support bulk operations.
This commit updates the draft deletion functionality to handle
multiple draft IDs at once, reducing localStorage writes.
2025-06-05 15:34:11 -07:00
Aditya Kumar Kasaudhan
9a4de8d9b8 drafts: Enable dynamic re-rendering of draft list in overlay.
This commit laying the groundwork for dynamic re-rendering of
drafts.

Previously, the draft list was rendered once with the overlay,
and re-rendering wasn't needed. However, to support features like
"undo," we now need to re-render the draft list dynamically.
2025-06-05 15:34:11 -07:00
Karl Stolley
a59f730279 popovers: Correct logic for visible reaction icon. 2025-05-30 12:50:12 -07:00
Prakhar Pratyush
b837c47ac3 hotkey: Support non-latin keyboard locales for shortcuts.
Earlier, keyboard shortcuts were not supported for non-latin
keyboard layouts.

This commit adds support for it.

Keyboard can be:
* configured to type latin text, with the QWERTY, AZERTY, etc layout.
* configured to type non-latin text.

For non-latin users, if a shortcut requires a key and it is not
present on the keyboard, they press the same physical key that a
QWERTY user would press.

Pressing QWERTY equivalent key is not a Zulip specific requirement,
non-latin users have confirmed in CZO that they use the same behaviour
on other applications.

Algorithm:
We need to determine the key combination pressed in a consistent way,
irrespective of the keyboard layout.

For keyboard layouts (e.g. QWERTY) where `event.key` results in
printable ASCII characters or named key attribute values like "Tab",
"Enter", etc., we use `event.key` directly to determine the key
combination.

For layouts where the character defined for a hotkey can't be typed
directly (e.g. 'a' in Cyrillic), users press the same physical key
combination that a QWERTY user would use (e.g. 'ф' on Cyrillic maps
to 'a' on QWERTY). In such cases, we derive the key combination
(QWERTY equivalent) using `event.code` and the `CODE_TO_QWERTY_CHAR`
map.

Here `event` is "keydown" event.

Once, the key combination is determined the action to perform is
executed.

Fixes: #19605.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
f506ccc5f4 hotkey: Fix Caps Lock incorrectly affecting Shift state in shortcuts.
Earlier, with Caps Lock enabled, pressing letters like 'a', 'i', etc
resulted in the keyboard shortcuts for 'Shift+A', 'Shift+I', etc
getting executed. Ideally, they should work only when 'Shift + Key'
is pressed.

We used to check capitalized letters, which can result either due
to `key` pressed with Caps Lock enabled or `Shift + key` pressed.

This commit fixes the bug by using the event modifiers states to
construct a fully descriptive string like 'Cmd+Ctrl+Alt+Shift+A',
and then look up that string in a single mapping for further execution.

We treat a-z letters case-insensitively. We distinguish between
'a' and 'A' as 'A' vs 'Shift+A'.

This descriptive string approach also resolves a bug where
`Ctrl + Meta + C/K/S/.` was working. We define the valid hotkey as
`Meta + C/K/S/.` for macOS and `Ctrl + C/K/S/.` for others.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
c2d0002b4f hotkey: Remove the usage of deprecated keypress event.
This commit removes the deprecated `keypress` event.

Now, we use the `keydown` event to handle all the cases.

Earlier, we used `keypress` because it allowed us to distinguish
between lowercase and uppercase characters using `event.which`.

For example:
* For 'r':
  * keypress.which = 114
  * keydown.which = 82
* For 'R':
  * keypress.which = 82
  * keydown.which = 82

As shown, `keydown.which` cannot distinguish between 'r' and 'R',
which is why `keypress` was helpful.

Now, modern browsers support `event.key` on `keydown`, which directly
gives 'r' or 'R' as needed. This makes `keypress` unnecessary, and
we can safely rely on `keydown` with `event.key` to get the exact
character.

An earlier commit in this PR #34570, in which we replaced
the `event.which` with `event.key` plays a major role as a prep
commit to help removing `keypress` event in this commit.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
ed87932c8a hotkey: Fix 'H' & 'N' being tested as unmapped keys.
Earlier, 'H' and 'N' were being tested as unmapped keys and the test
was falsely passing because these keys are handled by `process_keydown`
but the test was processing it with `process_keypress`.

This commit removes those keys from the test.

We already test them with keydown in other tests.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
e646c1bbec hotkey: Add tests for Shift + H hotkey.
Node tests for `Shift + H` hotkey was missing.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
075e398307 hotkey: Replace deprecated e.which with e.key.
The `keydown` and `keypress` event handlers defined in `hotkey.js`
were using `event.which`, which is deprecated.

This commit makes changes to use `event.key` instead.

As a side effect, it fixes a small bug where both `Alt+P` and
`Alt+Shift+P` could be used to toggle preview mode. Only `Alt+P`
is the defined shortcut for that.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
104b5c9731 hotkey: Remove a stale item in codes, in motion_keys test.
`"+": 187` was an unused item in `codes` object, in `motion_keys`
test.

This commit removes that.
2025-05-29 13:24:22 -07:00
Prakhar Pratyush
6e18aad7a6 hotkey: Fix "e shortcut works for anonymous users" test.
In f768d3330b, the node test
written was a noop because "e" hotkey is handled by `keypress`
instead of `keydown`. So, the expected codepath was never getting
executed at all.

This commit fixes the test.
2025-05-29 13:24:22 -07:00
Evy Kassirer
17ce7b90d3 input_pill: Add semi-transparent border around avatar.
Fixes #34499.
2025-05-28 17:40:28 -07:00
Evy Kassirer
0563a36b47 buddy_list: Fetch all subscribers before showing search results.
Work towards #34244.
2025-05-28 17:27:18 -07:00
Alex Vandiver
c2e0a27d2c upload: Fix uploading the same file twice in the same session.
This commit fixes a bug where uploading the same file a second time
in the same browser session would appear to the user to stall with
`Uploading [filename]...` in the composebox.  This is because
`tus-js-client` makes a HEAD request to check for already-uploaded
files -- and, if found, that request is used in the `upload-success`
callback.  That left the callback with no response body to parse, to
know what URL to insert.

Store the `/user_uploads/...` URL in the file metadata after a
successful upload, and if the fingerprint matches a previous upload,
pull that URL (and filename, as it may have changed server-side) out
of the previous upload's metadata.

Co-authored-by: Shubham Padia <shubham@zulip.com>
2025-05-28 09:23:51 -07:00
Anders Kaseorg
c356595ed5 upload: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-22 10:40:15 -07:00
Kislay Verma
92467f232f buddy_data: Clean up unnecessary rewires in test.
Instead of rewiring `narrow_state` functions, we create appropriate
filters to organically use the code paths during tests.

Fixes part of #32326.
2025-05-20 17:03:00 -07:00
Kislay Verma
5f86ac6e36 buddy_data: Fix error in test.
The test `get_conversation_participants` didn't need
rewiring in the first place.

The filter was not properly created - the field `channel_id`
was wrongly being used instead of `stream_id`.

Once the filter was fixed, the code automatically returned
 the expected stream_id and topic, without rewiring.

This eliminated the use of override_rewire in that test.

Fixes part of #32326.
2025-05-20 17:03:00 -07:00
Kislay Verma
b3fd46050e typeahead_helper: Clean un unnecessary rewires in test.
Instead of rewiring `compose_state`, we use its functions
to organically obtain the stream name etc as desired.

Fixes part of #32326.
2025-05-20 17:03:00 -07:00
Kislay Verma
059d72c908 pill_typeahead: Clean up unnecessary rewires in test.
This commit effectively shifts the mocking to a
lower level by mocking `typeahead_list_item.hbs`
instead of higher-level functions like `render_person`,
`render_user_group` and `render_stream`. This helps
eliminate the rewiring of those functions.

These functions are rigorously tested in
`typeahead_helper.test.cjs`.

Fixes part of #32326.
2025-05-20 17:03:00 -07:00
Kislay Verma
7f6e0aced1 drafts: Clean up unnecessary rewires in test.
This commit removes unnecessary use of override_rewire
in drafts.test.cjs, and creates data instead of mocking
functions returning that data.

It helped eliminate `stream_data.rewire_get_color` and
`sub_store.rewire_get`.

Fixes part of #32326.
2025-05-20 17:03:00 -07:00
Aman Agrawal
a9b51f80ba people: Defer loading user data during app load.
This should greatly reduce the symptoms of a bug where a stale
realm_users cache (missing a newly created user) results in the web
client missing the new user and throwing exceptions.
2025-05-20 13:55:48 -07:00
bedo
465a0ef0d0 message_util: Rename "get_messages_in_topic".
Follow-up commit.

This renaming clearly conveys that
fetched messages are cached.
2025-05-19 00:08:29 -07:00
Anders Kaseorg
8325a51750 unread_ops: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
c248459af2 search_pill: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
21fc5d71e1 tests: Move tests out from the middle of the Typeahead mock.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
77a92100df popover_menus_data: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
d8ba3b4ea7 navbar_menus: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
26f664be69 hotkey: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
f3cb557fb2 compose_validate: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
Anders Kaseorg
7c6d040fd8 compose_recipient: Avoid jQuery sizzle extension :visible.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-18 16:22:15 -07:00
whilstsomebody
2780360b00 unarchive: Add support for unarchiving archived channels.
This commit adds support for unarchiving archived channels
by introducing the `is_archived` parameter to the
`PATCH /streams/{stream_id}` API endpoint. Sending a PATCH
request with `is_archived: false` will unarchive the specified
channel.
2025-05-16 11:39:40 -07:00
Evy Kassirer
2cbf9e130e drafts: Store DM drafts with user ids instead of emails.
Fixes #34468.
2025-05-16 10:51:29 -07:00