Commit Graph

1701 Commits

Author SHA1 Message Date
apoorvapendse
3fd5673bbd compose: Support to convert math html to markdown.
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.
2025-01-30 11:08:56 -08:00
Sayam Samal
cb2d12d744 banners: Redesign server needs upgrade navbar banner.
As part of the banner redesign project, this commit applies the new
banner styles to the server needs upgrade navbar banner.
2025-01-30 10:17:39 -08:00
Sayam Samal
4bece9189b banners: Redesign organization profile incomplete navbar banner.
As part of the banner redesign project, this commit applies the new
banner styles to the organization profile incomplete navbar banner.
2025-01-30 10:17:39 -08:00
Sayam Samal
bf7d5637eb banners: Redesign profile missing required fields banner.
As part of the banner redesign project, this commit applies the new
banner styles to the profile missing required fields banner.
2025-01-30 10:17:39 -08:00
Sayam Samal
9664b1b550 banners: Redesign demo organization deadline navbar banner.
As part of the banner redesign project, this commit applies the new
banner styles to the demo organization deadline navbar banner.
2025-01-30 10:17:39 -08:00
Sayam Samal
b7853d9eb2 banners: Redesign bankruptcy navbar banner.
As part of the banner redesign project, this commit applies the new
banner styles to the bankruptcy navbar banner.
2025-01-30 10:17:39 -08:00
Sayam Samal
028e9dc58a banners: Redesign desktop notifications navbar banner.
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.
2025-01-30 10:17:39 -08:00
Vector73
32d131ab5a saved_snippet: Move "Create a new saved snippet" button to the bottom.
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.
2025-01-30 09:46:32 -08:00
apoorvapendse
ee104ab141 compose: Prompt topic typeahead after selecting stream.
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.
2025-01-29 17:25:19 -08:00
Lauryn Menard
078ce89380 util: Extract helper function for backoff of retries on error response.
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.
2025-01-29 15:00:23 -08:00
Shubham Padia
41c68fad2c stream: Allow non-admins to create channel without subscribing to it.
Fixes #33125.
We now add a creator pill on the channel create screen. For the rule to
not allow non admins to create a channel without subscribing to it, the
rule was most probably introduced to prevent creating a private channel
that you can't access and creating a public channel and then not being
able to find it. Those concerns aren't valid anymore with the new group
permissions system and UX changes respectively.
See
https://chat.zulip.org/#narrow/channel/101-design/topic/Rework.20UX.20for.20adding.20everyone.20to.20a.20channel.20or.20group.20.2333127/near/2064926
for more details.
2025-01-29 12:36:10 -08:00
Shubham Padia
274fdc5908 input_pill: Add disabled flag to make a pill disabled.
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.
2025-01-29 12:36:10 -08:00
Sahil Batra
3581d5feb8 node-tests: Add tests for functions used to check group permissions.
This commit add node tests for functions used to check permissions
a group has for rendering "Permissions" panel.
2025-01-28 10:06:31 -08:00
Sahil Batra
50799a1a87 settings: Show assigned group permissions in permissions panel.
Fixes part of #28806.
2025-01-27 15:32:15 -08:00
Sahil Batra
071037c55d settings: Show assigned stream permissions in group permissions panel. 2025-01-27 15:32:15 -08:00
Sahil Batra
893cdc8069 settings: Show realm permissions that group has in permissions panel. 2025-01-27 15:32:15 -08:00
evykassirer
10d7da81a0 copy_and_paste: Don't add code syntax if backtick is already present. 2025-01-27 15:30:15 -08:00
Shubham Padia
e912ada51e stream: Rename can_subscribe_others_to_all_streams.
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.
2025-01-27 11:26:06 -08:00
Kislay Verma
32f9ee7a62 topic_link_util: Add [ and ] as characters to escape.
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.
2025-01-25 11:41:25 -08:00
bedo
21199beb73 stream_delete_event: Include only stream IDs in the event.
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.
2025-01-24 17:58:32 -08:00
Maneesh Shukla
5910bfcaf9 left_sidebar: Rewrite left sidebar navigation area library.
Fixes: #26686.
2025-01-24 17:26:40 -08:00
Sahil Batra
52fbca65ce group-settings: Move functions used for group settings.
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.
2025-01-24 14:51:51 -08:00
Sahil Batra
255eee255b events: Pass group in functions called for updating the group.
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.
2025-01-24 14:51:51 -08:00
Sahil Batra
62ab21bd79 node-tests: Improve user group event tests.
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.
2025-01-24 14:51:51 -08:00
whilstsomebody
733ab5f2f8 reactions: Remove emoji container when reaction count is 0.
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
2025-01-24 13:32:35 -08:00
apoorvapendse
6586d9078e copy_and_paste: Paste Excel copied content as image and text.
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.
2025-01-24 11:10:38 -08:00
Aman Agrawal
dd33ad11f5 scroll_util: Account for $elem not direct child of scroll container.
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.
2025-01-23 15:53:09 -08:00
Prakhar Pratyush
033c706a03 search: Add support for empty string topic.
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.
2025-01-22 16:09:46 -08:00
Prakhar Pratyush
8a1b1590ad recent_view_search: Add support to search for empty string topics.
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.
2025-01-22 16:09:46 -08:00
Prakhar Pratyush
3706940df6 compose_closed_ui: Unify translation strings for reply button label.
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.
2025-01-22 15:55:23 -08:00
Prakhar Pratyush
181572021d get_stream_topics: Add support for empty topic name.
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.
2025-01-22 15:54:11 -08:00
Shubham Padia
1b8115d8e7 compose: Use can_subscribe_others to check permissions. 2025-01-22 14:27:06 -08:00
Shubham Padia
f40db2de28 stream_data: Use can_add_subscribers_group to check permissions. 2025-01-22 14:27:06 -08:00
Shubham Padia
2ccfe36f01 settings_data: Rename user_can_subscribe_other_users.
Rename it to `can_subscribe_others_to_all_streams` to accurately reflect
what it does.
2025-01-22 14:27:06 -08:00
Shubham Padia
3bf87228a2 settings: Use can_add_subscribers_group instead of realm policy.
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.
2025-01-22 12:33:58 -08:00
Steve Howell
d00934b0ef bug fix: Check offsets when browser doesn't canonicalize.
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.
2025-01-22 09:16:50 -08:00
Steve Howell
8227070087 timerender tests: Kill off tests for canonicalizing.
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.
2025-01-22 09:16:50 -08:00
Steve Howell
094b59c3e7 timerender test: Add explicit test for Montreal/Toronto.
This might not actually work in all browsers, but it
expresses our intention, and it is what works on node.
2025-01-21 13:24:58 -08:00
Kislay Verma
8379f0cffb topic_link_util: Accept channel name instead of syntax text.
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
2025-01-21 13:21:11 -08:00
Sahil Batra
1fcda48d68 compose: Show system groups in silent mentions typeahead. 2025-01-16 14:25:04 -08:00
Sahil Batra
2e4d4c1d6a compose: Show all groups with at most 20 members in DM typeahead.
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.
2025-01-16 14:25:01 -08:00
Prakhar Pratyush
25941c1d19 compose_reply_label: Show realm_empty_topic_display_name for topic="".
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.
2025-01-14 13:52:55 -08:00
Anders Kaseorg
f223251ffe requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-14 09:42:16 -08:00
Aman Agrawal
05c0213cad recent_view: Prevent participant avatars from overflowing.
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`.
2025-01-13 18:30:38 -08:00
Aman Agrawal
1587ebf661 recent_view: Remove unused test mock. 2025-01-13 18:30:38 -08:00
Vector73
e487a5c8c7 reaction: Add user object back in reaction events.
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.
2025-01-13 12:57:55 -08:00
Maneesh Shukla
16188400f7 password: Add password limit inidcator to form.
Fixes: #27922.
2025-01-13 11:53:40 -08:00
Prakhar Pratyush
e3ce4c5766 drafts_table: Show realm_empty_topic_display_name for topic="".
This commit adds support to display `realm_empty_topic_display_name`
value in the drafts table for topics having the actual value of
empty string.
2025-01-10 14:32:55 -08:00
Prakhar Pratyush
8483b7bbcd recent_view_row: Show realm_empty_topic_display_name for topic="".
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.
2025-01-10 14:32:55 -08:00
Prakhar Pratyush
e9553daee4 topic-list-item: Show realm_empty_topic_display_name for topic="".
This commit adds support to display `realm_empty_topic_display_name`
value in the left sidebar for topics having the actual value of
empty string.
2025-01-10 14:32:55 -08:00