Commit Graph

813 Commits

Author SHA1 Message Date
Karl Stolley 7291f0a919 info_density: Set font size, line height vars in dev. 2024-04-11 10:25:03 -07:00
Shubham Padia 3f6ceba39a settings_users: Add role filter to user list.
Fixes #18617.
- The role filter is added to both active and deactivated user
list. The original plan was to introduce a multi select checkbox
dropdown for the roles, but since that component is not ready yet,
we will use the dropdown component for the first iteration.
- To accomodate multiple filters, we have used an approach
similar to the one in recent_view_ui.js where we use dropdown
callback function and on("input") event on text search to set the
filter value in memory. The predicate functions uses these filters.
- We have also changed the default message when there are no
users to show to reflect `filters` instead of `current filter`.
2024-04-10 13:45:06 -07:00
N-Shar-ma 30b68214d3 settings: Do not scroll to save button when typing in textarea / input.
In an unsaved state, when focus is in a textarea or an input of type
text, we don't yet scroll the save button into view to not interrupt the
user's typing. When the input / textarea loses focus, we scroll then if
needed, triggered via the `change` event.
2024-04-10 11:18:17 -07:00
evykassirer 2014c25cb4 compose_actions: Include message type in opts for `start`. 2024-04-04 16:34:42 -07:00
N-Shar-ma a3ed41efa0 typeahead: Redesign the function `compare_people_for_relevance`.
We make the following changes:

- Remove the dm partnership check before calling the comparator passed
by the caller, and instead have the more thorough `compare_by_pms` be
the final tie breaker. This deprioritization of dms fixes the bug where
dm partners would be prioritized even if they had not participated in
a stream conversation over recent senders who are not dm partners.

- Make the passed comparator optional, since the tie breaker is same as
the comparator that was passed so far for dms, and only pass it in case
of a stream conversation.
2024-04-04 13:13:11 -07:00
N-Shar-ma a8954ad00e tests: Add missing setup to typeahead_helper tests passing as a fluke. 2024-04-04 13:13:11 -07:00
Lauryn Menard 80d4a704fe mentions: Replace "channel" wildcard when selected via typeahead.
Until "stream" is renamed to "channel" in user facing strings,
when "channel" is selected from the composebox typeahead options,
the "stream" wildcard syntax will be inserted in the message
content instead.

Adds some helper functions to util.ts to initially be used to
check/convert "channel" to "stream" during the rename process,
with the intention of then converting those helpers for the
reverse (check/convert "stream" to "channel") in the final part
of the rename process.

Part of project to rename "stream" to "channel".
2024-04-04 11:16:07 -07:00
Lauryn Menard e700e818e5 mentions: Add "channel" as a wildcard mention.
Adds "channel" to the `stream_wildcards` frozenset for stream
wildcard notifications on the backend/server.

Updates frontend/web-app to handle "channel" as the other stream
wildcards are handled in the typeahead and composebox modules.

Updates the API version and documentation for the addition of
"channel" as a wildcard mention. But does not change any of the
functionailty of (or deprecate) the "stream" wildcard at this
point.

Part of project to rename "stream" to "channel".
2024-04-04 11:16:07 -07:00
Anders Kaseorg 8fb1117cef eslint: Fix no-jquery/no-append-html errors that need test changes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 10:11:57 -07:00
Alex Vandiver 01860422af util: Do not use look-behind in wildcard mention checks.
92fa9ee78c switched this regex to match the server-side regex, but
Safari < 16.4 does not support look-behind in regexes.

Switch to matching on start-of-string or a positive character class.
2024-04-03 17:39:26 -07:00
Karl Stolley 6d5243148a timestamps: Calculate the maximum timestamp width in use.
Fixes: #26970
2024-04-03 17:38:43 -07:00
Anders Kaseorg 1e4427caf5 tests: Fix incorrect uses of .indexOf(…) > 0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 15:13:33 -07:00
Anders Kaseorg 191345f9d6 ui_util: Fix HTML injection bug in replace_emoji_with_text.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 13:11:47 -07:00
Anders Kaseorg 4dc27216f4 rendered_markdown: Fix HTML injection bug in update_elements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 13:11:47 -07:00
Lauryn Menard 48a486a584 people: Update get_mention_syntax to better account for wildcards.
In `composebox_typeahead`, it is completely possible to call
`people.get_mention_syntax` for a wildcard mention, which will not
have a `user_id`.

Updates `get_mention_syntax` to not raise a blueslip error if the
mention syntax is for a wildcard mention.

Adds "topic" to the array of possible wildcard mention strings.

Tightens the types for the parameters for `get_mention_syntax`, by
setting `user_id` to be number or undefined, and by setting `silent`
to default to false (which is expected in a number of modules where
this function is called).
2024-04-03 12:19:27 -07:00
evykassirer 249a3935ac compose_ui: Add message_type to ComposeTriggeredOptions. 2024-04-02 17:26:12 -07:00
evykassirer 741b8c308a user_topics: Always store stream name in UserTopic. 2024-03-30 16:25:34 -07:00
abdelrahman725 b0a4b8e439 passwords: Add keyboard accessibility for show/hide password icons.
Tweaked by tabbott to add the required tabindex configuration in the
password reset, password change, and registration forms as well.
2024-03-30 16:16:27 -07:00
evykassirer 5cb32fe733 pill_typeahead: Simplify fake this objects. 2024-03-30 10:41:38 -07:00
evykassirer fc3ab45b46 typeahead: Pass input element to source instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer bdf4449ebf typeahead: Pass input element to updater instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer 9f83d14fb7 pill_typeahead: Use query passed to source instead hacky this. 2024-03-30 10:41:38 -07:00
evykassirer b4299d99fd typeahead: Pass query to updater instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer f0578c318c typeahead: Pass query to sorter instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer 9fc6793809 typeahead: Pass query to highlighter_html instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer cf9cf14dde typeahead: Pass query to matcher instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer 1f059f5906 composebox_typeahead: Use local `token` instead of typeahead `this`. 2024-03-30 10:41:38 -07:00
evykassirer ba41eace94 composebox_typeahead: Use local `completing` instead of typeahead `this`. 2024-03-30 10:41:38 -07:00
evykassirer c7b12c996c typeahead: Convert module to typescript.
This contains two more complex changes:

- The default versions of sorter and matcher assume that ItemType is a
string. But the Typeahead class works on a generic ItemType and I'm
not aware of a way to assert that this function is only called for
typeaheads with string items. For `matcher`, we can assert that the
items are strings. `sorter` is now a required option instead of an
optional one that could fall back to the default.

- `element` can be either an `input` element or a `contenteditable`
`div`. We distinguish between them using `.is("[contenteditable]"))`
but TypeScript doesn't understand that. So we replaced `this.$element`
with `this.input_element` where `input_element` is an object with the
`$element` and also a `type` specifying which type of element it is
(input or contenteditable).
2024-03-30 10:41:38 -07:00
evykassirer 954da81f4c typeahead: Replace this.options with direct fields on Typeahead. 2024-03-30 10:41:38 -07:00
adnan-td 87dee7a9b2 invite_user_modal: Replaced email text_area with input_pill.
This makes the widget considerably more attractive, and probably a bit
more usable.

Fixes #29391.
2024-03-29 11:13:03 -07:00
Anders Kaseorg 26ae533985 eslint: Fix @typescript-eslint/prefer-optional-chain.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 8f07d830f2 narrow_state: Remove unused narrowed_to_search, narrowed_to_starred.
They’re unused as of commit de0db7ad1a
(#28636).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
afeefuddin ce3e609d90 lightbox: Remove unneeded unit test. 2024-03-28 13:56:56 -07:00
N-Shar-ma 46147cd13c copy_and_paste: Add documentation for keyboard shortcuts for pasting.
Fixes: #29209.
2024-03-28 13:07:34 -07:00
N-Shar-ma 7895b05284 turndown: Enable turndown in production. 2024-03-28 13:07:34 -07:00
Varun Singh 894756addc submessage: Replace bogus test data with valid objects.
The test data was not the correct representation of submessage's
content field. This caused the zod schema to throw error.

This is a temporary solution and eventually we have to move to an
efficient approach making the test data more representative and
accurate.

Discussion:
https://chat.zulip.org/#narrow/stream/6-frontend/topic/TypeScript.20migration/near/1766122
2024-03-28 12:59:12 -07:00
Varun Singh 7329100dc7 submessage: Send only relevant 'event' array data.
We sent entire 'events' array to 'widgetize.activate' and then
removed its first element(using .shift()); instead we should
send only relevant data ie. the entire array after the first element.

This also helps us avoid an extra check in node tests.
2024-03-28 12:59:12 -07:00
Anders Kaseorg db1f69e72f compose_validate: Simplify away extra stream_data lookups.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Anders Kaseorg 807a4428f6 compose_validate: Remove autosubscribe feature.
This was only used in the undocumented narrow_stream mode, and relied
on a deprecated synchronous XHR request.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Karl Stolley 286d44bf33 settings: Add new web information density settings.
Note that these settings are not operative at present, and are only
visible in the settings UI in the development environment.
2024-03-27 12:58:32 -07:00
Sahil Batra 19a7c75400 settings_components: Convert to typescript. 2024-03-26 10:32:15 -07:00
N-Shar-ma 9cedf0e8bc compose: Trigger language typeahead on using code formatting button.
To increase the discoverability of the possibility of specifying the
language for a code block, we trigger the language typeahead when code
syntax is added using the code formatting button. A blank option is
shown preselected in the typeahead, so that pressing enter will not
mistakenly add a language to the code block.

We only trigger the typeahead on empty opening fences when added by the
button, by setting a state variable to true when adding the syntax using
the button, checking for this state when sourcing languages for the code
typeahead, and then resetting the state variable to false.

Fixes: #29150.
2024-03-25 16:30:03 -07:00
N-Shar-ma b6a04aaa83 typeahead: Add option for word order not mattering for query matching.
Uptil now, the `query_matches_string_in_order` function would respect
the order of words in the query string when matching a source string.
This meant that for query "two one", the source string "one two three"
would not be matched.

For more flexibility, a new function, `query_matches_string_in_any_order`,
has been added., which returns true if each word in the query string matches
the prefix of a distinct word in the source string, else it returns false.

The algorithm for computing this is quadratic in terms of the source word
count so can be a little expensive, but it is only currently used for
searching topics in Recent Conversations, where the strings' length is
limited by the max stream / topic name length allowed, so this should be
performant enough for this use case.
2024-03-22 15:20:40 -07:00
Alex Vandiver 92fa9ee78c util: Use the same regex as the backend for wildcard mentions. 2024-03-22 09:36:12 -07:00
Vector73 f758ca596b custom_profile_fields: Add "required" parameter to the profile fields.
Fixes #28512.
2024-03-21 10:48:54 -07:00
Anders Kaseorg 85d5669a4a web: Fix selectors to correspond with annotated types.
TypeScript does not check that these annotations are consistent with
the given selector strings.  We need to ensure that ourselves for
runtime safety.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-19 13:14:27 -07:00
shashank-23002 b74dabfaa4 alert_words: Highlight overlapping alert words more accurately.
This fixes a bug where alert words that are contained in another alert
word would have only the smaller alert word highlighted.

Note that it does not handle weirder cases, like "one two" and "two
three" being alert words; "two three" will always be highlighted, and
not "one"; this is probably fine in practice.

Fixes: #28415
Co-Authored-By: danieldotcomcoder <daniel_shdeed@hotmail.com>
2024-03-19 11:20:16 -07:00
Mahhheshh e7adde96e0 message_edit: Reimplement message history modal as an overlay.
We redesign the message history modal to make it look similar to the
drafts and scheduled messages, using the shared styling/rendering
logic for that those existing elements to have a less goofy widget.

Fixes #28695.
2024-03-18 17:26:28 -07:00
Pratik Chanda a504753961 stream-settings: Fix right panel resetting on filter change.
Earlier in stream settings, filtering for streams by search stream
name would reset the right panel to default if a stream was selected
from stream row.

This commit fixes the behaviour by keeping the stream open in right
panel in stream settings even on any filter change.
2024-03-15 17:22:10 -07:00