This commit tries to address the problem of not getting the
latex markdown on selecting and quoting a message which
contains normal text as well katex html elements.
It works by grabbing the parent of all the katex elements,
display (mathblocks) as well as inline expressions
and iterating over each immediate child to convert the
elements into markdown based on certain conditions.
Support has also been added to convert inline expressions to an
approximate markdown representation.
To facilitate selection of inline math expressions along with
text nodes, which are intermediate pieces of text sandwiched
between two katex spans, we transform the paste_html to
have spans instead of text nodes, so that they can be
processed by turndown js, since its filter function only
iterates through Elements and not TEXT_NODE.
The new tests have been added in katex_test_cases.json to
prevent cluttering the node tests in copy_and_paste.test.cjs.
These tests are looped over in the node tests.
Fixes#31608.
As part of the banner redesign project, this commit applies the new
banner styles to the desktop notifications navbar banner.
This commit also acts as a base for the following banner redesign
commits by defining the `banners.ts` module, which now acts as the
centralized module to handle the banner rendering and sets up the
common event listeners.
Renames "Add a new saved snippet" to "Create a new saved snippet" and
"Add saved snippet" tooltip to "Insert saved snippet".
Moves "Create a new saved snippet" button to the bottom sticky area of the
dropdown.
Enable a consecutive topic typeahead after a user selects a stream via the
typeahead menu. Previously, users had to manually enter ">" after selecting
a stream.
Before, encountering ">" returned "topic_jump," which prevented the
topic list from triggering since "topic_jump" indicated the topic was
selected. The implementation is changed to slice the token and process it
in get_candidates to trigger the appropriate typeahead.
Adjustments include changes to regexes for accurate triggering of stream or
topic typeaheads based on the presence of ">" in the current token.
Removes hint for stream mentioning use of ">"
for topic suggestions, although that feature is
still functional.
The hideAfterSelect() function in composebox_typeahead.ts was modified.
This prevents closing the typeahead when a stream is completed.
The TopicSuggestion type is updated to show stream typeahead suggestion
as the first option in the topic list with a privacy icon and no description
in case when no character follows the '>' i.e. when the token ends with '>'.
The edge where stream and topic have the same name is also handled with
the help of a flag.
Add stream as the prefix to topic suggestions in the typeahead.
To make this happen, changes are made in the related handlebars
template.
Update topic list stream option label.
This changes the option label for stream in the topic
list from (mention channel) to (link to channel) as per
https://zulip.com/help/link-to-a-message-or-conversation.
Tests are updated, and a new test is added to validate the behavior.
Test coverage is added for the new `render_stream_topic` method.
Fixes: #32184.
Extracts message_fetch and get_events algorithms for calculating the
exponential backoff into a shared helper function.
These match the algorithm that were designed for the Python API, except
that we use a ratio of 2 rather than sqrt(2) in the message_fetch code
path.
A disabled pill cannot be removed. It will not have the `x` sign inside
it's pill. Pressing backspace on the pill will not remove it. But it
will still be possible to shift focus on the disabled pill using the
backspace button.
We decided to keep disabled not as a property of `item` and instead of
the pill via `InputPill`. This means that a pill is disabled and not an
item. Also, since the item types vary so much between user, user group,
channel and other pills, adding disabled to `InputPill<ItemType>` makes
it much more simpler to add this capability to wherever needed one by
one.
We also need to pass this property to `generate_pill_html` so the
respective functions can respect that property and render the pill
accordingly.
While this feature is not in use at the immediate moment, we've kept it
around since it is likely to be useful in the future.
Rename `can_subscribe_others_to_all_streams` to
`can_subscribe_others_to_all_accessible_streams` so it's clear that we
are not attempting to check basic access in this function.
These characters cause the fallback markdown
links produced (#30071) to be broken.
Broken links are not produced when these are present
in `#**channel>topic**` syntax. It is only a problem
with the fallback markdown links.
Fixes#32369
Migrate stream delete event to include only stream ids in the form of
"stream_ids": [1,...], because clients only need the ids.
While keep sending ids in the form of "streams": [{stream_id: 1},...]
for compatibility with all clients other than web.
This commit moves get_realm_user_groups_for_setting and
get_realm_user_groups_for_dropdown_list_widget functions
from user_groups.ts to group_permission_settings.ts.
This change is needed to avoid import cycles in further
commits to add "Permissions" panel for groups.
We now pass group in functions called while handling group update
events, instead of fetching the groups in those function as we
will need the old setting value in future commits.
Tests for testing user group events does not stub "user_groups"
module anymore as it is mainly used to handle data and it is
easy to test the events without stubbing them.
While adding a new reaction, we create a new JQuery element
called "message_reaction_container" and append it to the
view to display the emoji.
Previously, when the reaction count became zero for an emoji,
we used to just remove the emoji but not the JQuery element
mentioned above, requiring a reload to remove it. This
inconsistency introduced a bug in the UI. causing unwanted
spaces between emojies as this element used to get accumulated.
This commit resolves the bug by introducing logic to remove
reaction containers with no reactions.
Fixes: #32983
This ensures that using `^V` pastes the content from excel as
an image.
To get normal text in a formatted manner one can use
`^⇧V`.
The earlier conditions in `is_single_image` caused
the classification to fail in case of Excel pasted
content, which is why we check for the for the XML
namespaces associated with Microsoft in the pasted
HTML.
Fixes#32968.
When using `position` to get the scroll offset, it uses `offsetParent`
to calculate the offset which is not necessary the scroll container.
To account for this case, we use `offset` to correctly calculate
the position of element relative to the document.
This commit adds support to display `realm_empty_topic_display_name`
value (in italics) in the search suggestions & search input pills
for topics having the actual value of empty string.
We show `realm_empty_topic_display_name` for empty string topics
in the recent conversations view.
This commit makes it possible for users to search for
the `realm_empty_topic_display_name` value to filter out empty
string topics.
This commit unifies translation strings for reply button label
to reduce translation effort.
Both the `has_empty_string_topic` and other cases now use a single
"Message <z-recipient-label></z-recipient-label>"`, with dynamic
content passed appropriately.
This commit is a part of the work to support empty
string as a topic name.
Previously, empty string was not a valid topic name.
Adds `allow_empty_topic_name` boolean parameter to
`GET /users/me/{stream_id}/topics` endpoint to decide
whether the topic names in the fetched `topics` array
can be empty strings.
If False, the topic names in the fetched response will
have the value of `realm_empty_topic_display_name` field
in `POST /register` response replacing "".
Fixes part of #23291.
We are using `can_add_subscribers_group` instead of
`invite_to_stream_policy` to check whether a user can subscribe other
users.
We've removed `invite_to_stream_policy` from the frontend wherever
applicable.
This is more of a workaround than a bug fix.
Some JS implementations are less "aggressive" about
canonicalizing things like America/Montreal to America/Toronto.
We instead use offset checks.
These tests are false positives in some cases, since
browser behavior varies.
We will kill off the function soon, but for now we
still maintain 100% coverage (albeit indirectly).
I also split up a test into two smaller ones.
In the function `get_stream_topic_link_syntax`,
we used the typed syntax text to make out
the channel name and then use it to
generate the appropriate link syntax.
We change that to directly accepting the
channel name.
This is in preparation for #31420
Previously, all the non-system groups were shown in the DM
recipient typeahead. Now, we show system groups as well but
do not show groups with more than 20 members.
This commit adds support to display `realm_empty_topic_display_name`
value as the compose reply button label for topics having the actual
value of empty string.
We update max_avatars on rerenders based on recent view width
to prevent participant avatars from overflowing their width.
We use resize event to update `--recent-view-max-avatars` which
is checked on `complete_rerender`.
The deprecated `user` object was removed from message objects
and reaction events in #32701. This commit restores the `user` object
in reaction events to maintain compatibility with mobile clients.
This commit adds support to display `realm_empty_topic_display_name`
value in the recent conversations view for topics having the actual
value of empty string.