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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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>
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.
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.
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.
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.
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.