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`.
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.
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.
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".
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".
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.
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).
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).
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
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.
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>
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.
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.
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>
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>
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.
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.