Commit Graph

1430 Commits

Author SHA1 Message Date
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
Prakhar Pratyush
53ba17e1e0 narrow: Handle narrow links with empty topic names.
This commit ensures that narrow links involving
empty topic names, such as:

* #narrow/channel/1-general/topic//near/12345
* #narrow/channel/1-general/topic/

work correctly in the web client.

This change ensures proper navigation and behavior
for such links.
2025-01-10 14:32:55 -08:00
Prakhar Pratyush
de78864b8c compose: Add support to send channel message with empty topic name.
Previously, the client tweaked messages sent in a channel with
an empty topic box to use the topic "(no topic)".

This commit updates the behavior to stop applying that tweak.
Messages will now be sent with an empty string as the topic
as we now support the empty string as a valid topic name.
2025-01-10 14:32:55 -08:00
Prakhar Pratyush
fd67e31163 web: Add parameters to API requests for empty topic name support.
This commit adds `allow_empty_name: true` to the following
endpoints to receive empty strings as topic name when such
topics are available:
* `GET /messages`
* `GET /messages/{message_id}`
* `GET /messages/{message_id}/history`

Also, it adds `empty_topic_name` client capability for spectators.

These changes are part of the broader effort to enable
support for empty string as a topic name.
2025-01-10 14:32:55 -08:00
Aman Agrawal
4385005200 message_list: Avoid rerender of user sidebar when adding msgs.
Added methods to live update user sidebar when messages are
added or removed from the message list without doing a complete
rerender.
2025-01-10 11:23:23 -08:00
Aman Agrawal
df0d3b25c9 buddy_list: Use participants data from current message list.
Instead of tracking an outdate participants data, we use the
`participants` data from the current message list.
2025-01-10 11:17:46 -08:00
Kislay Verma
fadbca1b72 composebox_typeahead: Avoid opening on multiline stream/topic names.
Since Zulip channel and topic names cannot
contain newlines, we should not show channel
or topic suggestions if the `#**stream>topic`
syntax is spread across multiple lines.

So we tweak the regexes to exclude \n.

We do not need to change the regexes in `marked.js`
or `markdown/__init.py__` since
the message text is already split at newlines
before being matched against those regexes,
so a newline will never be present during matching,
both in the frontend and the backend.
2025-01-10 09:21:06 -08:00
Steve Howell
a1217fbc5a compose_validate test: Use FakeComposeBox for size limits.
This commit simplifies a compose_validate test by
using FakeComposeBox.

It also exposes $send_message_form to the callers.
(The general idea here is that for any individual
test, we don't want the developer to have to
switch between thinking about low-level zjquery
idioms and higher-level abstractions.)

This commit also removes the use of mock_template,
since the template in question generates trivially
easy html to deal with (and we verify the actual
effects to the DOM).
2025-01-09 15:08:17 -08:00
Steve Howell
a3c76646b2 FakeComposeBox: Extract instance vars for content/preview.
Within FakeComposeBox I **mostly** want to keep the code
concrete (using explicit selectors), but these two
concepts are an exception to that rule:

    content textarea
    preview message area

In particular, for the DOM element that is the textarea
where you compose your message in markdown (i.e. the
main edit area), the real code has different ways of
expressing that in jQuery.

Since the content area is a singleton on the entire page,
a lot of code sensibly does an id search for the element.

There are some other pieces of code that do another
sensible thing, which is to search for the DOM element
within the container by the class name of .message-textarea.

This aliasing may cause some headaches down the road
for testing, but this commit should make it a little
easier to work around that in the future.
2025-01-09 15:08:17 -08:00
Steve Howell
a6f2197091 node tests: Broaden what FakeComposeBox.reset does.
I moved some existing code into reset, as well as
making sure a common banner has zero length.
2025-01-09 15:08:17 -08:00
Steve Howell
0a6a37fcff node tests: Extract compose_helpers lib.
For now compose_helpers only includes FakeComposeBox.
I don't love either of the names, but some of the alternatives
that I thought of have their own tradeoffs.

The compose_helpers module will soon have other
helper classes or functions in it, possibly including
the mock_banners helper from lib/compose_banner.

I don't want to step on mock_banners yet, because
I have two possible plans for improving that code,
and I haven't decided what's best yet, so for now
I don't want to step on it or move it, so I am
just leaving that alone for now.

Gotta start somewhere.
2025-01-09 15:08:17 -08:00
Nehal Sharma
04f06a4588 integrations: Add support for BigBlueButton voice only calls.
We now allow users to create voice calls when their call provider is
BigBlueButton. This is done by creating a call where cameras are
disabled for all participants in the call -- a voice call, and making
only the call creator the moderator, so no one else can switch a voice
only call to a video call.

Also, we stop using the deprecated fields "attendeePW" and "moderatorPW"
in the Big Blue Button API, and use "role" instead.

The side effects are that now we only support BigBlueButton 2.4 and
above, and that only the call creator is a moderator and all other
joinees are viewers for all BigBlueButton calls.

Fixes: #26550.

Most of the code for the integration was written by Nehal.
Apoorva made the changes that resolve conflicts which were
introduced because of the `typed_endpoint` decorator.

With some documentation tweaks by tabbott.

Co-authored-by: Apoorva Pendse <apoorvavpendse@gmail.com>
2025-01-09 13:54:46 -08:00
Vishesh Singh
37e0dff013 compose_pill: Show bot icon after bot name.
Show the bot icon after the name on compose pill if it
is a bot.
Align the bot to the center.

fixes part of #28561.
2025-01-09 11:58:20 -08:00
whilstsomebody
569b07477b compose: Rename over_limit to textarea-over-limit.
According to the current naming convention, underscores are used
instead of hypens in class names, and this is more globally unique for
its meaning.
2025-01-07 17:49:31 -08:00
Sayam Samal
6557cd74cd stream_color: Replace spectrum color picker with native color picker.
This commit replaces the spectrum color picker used in the stream
popover and stream settings with a custom color picker popover, which
contains a grid of predefined color swatches and a custom color option.

The custom color option uses the HTML5 <input type="color"> which shows
the native browser color picker UI.

Fixes #14961.
2025-01-07 17:27:23 -08:00
Steve Howell
d0730131a2 compose tests: Create stubs for height and css.
This is a bit of an emergency fix to fix the build, but
it is probably close to what we want.

Any test that cares about the height of the compose box
can probably override this behavior.  Likewise for any
css calls.
2025-01-07 16:34:31 -08:00
Aditya Kumar Kasaudhan
79be013882 compose: Remove extra blank line before lists.
Previously, inserting a bulleted or numbered list via the compose
box added an extra blank line before and after the list.

This commit removes the extra blank line inserted before the list.

Fixes #32607.
2025-01-07 14:20:33 -08:00
Saubhagya Patel
c44c153b9a settings: Improve UI for email changes.
This commit includes the following changes:
 - The email field is now a disabled text field.
 - An "Edit" (pencil) button is added next to the email
   field, which opens the change email modal.
 - The "Edit" button is not shown if the user doesn't
   have permission to edit their email.
 - When email changes are disabled, the "email changes are
   disabled" tooltip now appears over the email field, which
   previously appeared to the right of the email field.
 - Refactor `settings_org.test.cjs` to align with the changes
   of the added "Edit" button.

Fixes #31975.
2025-01-07 14:17:23 -08:00
Saubhagya Patel
b15fb45408 settings: Use text cursor for "Email" when email changes are disabled.
This commit includes the following changes:
 - Use a regular text cursor in place of a pointer cursor for the
   "Email" field label when the email changes are disabled.
 - Implement tests to verify the above changes made.
2025-01-07 13:44:53 -08:00
Saubhagya Patel
ad766c802e settings: Use text cursor for "Name" when name changes are disabled.
This commit includes the following changes:
 - Use a regular text cursor in place of a pointer cursor for the
   "Name" field label when the name changes are disabled.
 - Introduce a class named `cursor-text` that sets the property
   `cursor: text;`.
 - Implement tests to verify the above changes made.
2025-01-07 13:44:53 -08:00
Steve Howell
b5d0858632 compose tests: Encapsulate zjquery interactions. 2025-01-07 13:16:35 -08:00
Steve Howell
31bdbd0f67 compose tests: Rename "foobarfoobar". 2025-01-07 13:16:35 -08:00