Commit Graph

1600 Commits

Author SHA1 Message Date
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
Steve Howell
9da5b8e7be compose tests: Remove unnecessary zjquery setup.
There is no point creating all this fake DOM if are
not gonna validate anything about it.
2025-01-07 13:16:35 -08:00
Steve Howell
586eb46ef1 compose: Rename enter_with_preview_open.
The old function name sounded like you were entering
preview mode when, in fact, hitting the enter key
in some cases **exits** you from preview mode.

This was particularly confusing to read in the tests.
2025-01-07 13:16:35 -08:00
Sahil Batra
a5e5a010fe stream-events: Handle update events for deprecated properties.
We just do nothing and avoid any warnings for update events
received for "stream_post_policy" and "is_announcement_only"
properties.
2025-01-07 12:17:37 -08:00
Sahil Batra
1175467d45 stream-settings: Remove code related to stream post policy. 2025-01-07 12:17:37 -08:00
Sahil Batra
bbf43a2866 stream-settings: Use new "can_send_message_group" setting. 2025-01-07 12:17:36 -08:00
Sahil Batra
101e94b052 streams: Add group based setting to control posting permissions. 2025-01-07 12:17:07 -08:00
Steve Howell
d0a2320edd stream_search test: Avoid leaky mocking. 2025-01-07 09:43:33 -08:00
Steve Howell
b1a883ecf9 search test: Use override_rewire for is_using_input_method. 2025-01-07 09:43:33 -08:00
Steve Howell
008f529555 narrow_local test: Introduce test_fixture helper.
We also use override_rewire in a couple places.
2025-01-07 09:43:33 -08:00
Steve Howell
9f952563e3 message_events tests: Avoid top-level override. 2025-01-07 09:43:33 -08:00
Steve Howell
3895e91b23 hotkey tests: Make processing_text mocks more granular. 2025-01-07 09:43:33 -08:00
Steve Howell
8583e64037 util node tests: Prevent Intl.ListFormat leaks.
These never happen in practice since util is near the
end of the alphabet, but if you had run the tests in
reverse order, you would have seen this leak.

This leak was introduced in the efb2a5a38d commit.
2025-01-07 09:43:33 -08:00
Steve Howell
b87d64cd8a node test runner: Prevent Handlebars quirks.
We re-require templates.ts before testing each
new test module during the node tests.

This makes it so that if we make mocks in two
different tests, where such mocks influence
how the Handlebars helpers work, then both
tests will have registered their own copies
of the Handlebars helpers.
2025-01-07 09:43:33 -08:00
Steve Howell
09716c624f settings_user_topics test: Use explicit override for sorting.
In general we want to mimimize the amount of setup at the top
of a test module and just let individual tests explicitly
mock what they need to mock.

The `override` helper has the advantage that it avoids dead
code.  For example, if the way we invoked the list widget
here no longer required sorting, the unit tests would complain
about the crufty override, whereas the previous code doesn't
really have that kind of future-proofing.
2025-01-07 09:32:52 -08:00
Steve Howell
9a7efc88f2 settings_profile_fields test: Add mocking helper.
We now only explicitly mock the list_widget in a single test,
and we don't need to stub out the sorting functions.
2025-01-07 09:32:52 -08:00
Steve Howell
43207d37af alert_words_ui test: Excercise the template. 2025-01-07 09:32:52 -08:00
Steve Howell
47b4b4a506 alert_words_ui test: Avoid bizarre idioms.
We now just do the following in the mocking:

    - capture which items are passed into the list
      widget

    - simulate the call to modifier_html to exercise
      the template rendering
2025-01-07 09:32:52 -08:00
Shubham Padia
0b4fe15c8a mention: Mentions via subgroup should be highlighted.
This commit does not add highlighting to any pre-existing group mentions
for which a user was part of the mentioned group via a subgroup. This
only fixes it for mentions moving forward.
Fixes https://chat.zulip.org/#narrow/channel/9-issues/topic/group.20mention.20not.20highlighted/near/2008541
2025-01-06 16:53:21 -08:00
Alex Vandiver
ac7bdc73bb upload: Use the returned JSON from the server for filename and URL. 2025-01-06 15:25:32 -08:00
Alex Vandiver
2d758951b4 upload: Immediately re-enable send after upload completes.
Do not make the user wait for the animation + 100ms to click "send."
2025-01-06 15:25:32 -08:00
evykassirer
ae805763bc compose: Use an icon for the mac command hotkey hint. 2025-01-06 11:29:38 -08:00
Anders Kaseorg
97d1a55737 blueslip: Require record for more_info.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-02 17:30:40 -08:00
Prakhar Pratyush
469cc53187 export: Add banner if admin's private data export setting is disabled.
This commit introduces a banner on the "Start Export" modal
to notify the admin that their personal setting to export
private data is not toggled ON.

The banner is shown when the 'Export type' is 'Standard' and
admin's personal setting to export private data is not toggled ON.

The banner ensures admins are aware their private data will
not be exported unless they enable the respective setting.
2025-01-02 16:40:33 -08:00
Lauryn Menard
d6db6e3806 invite-modal: Fix invalid custom input to not show "NaN".
Updates the invite modal so that if the custom input is 0, the
submit button is deactivated, since an email invitation or invite
link that immediately expired would be unusable.

Also, updates the custom input to show 0 if a user navigates away
from and back to the custom input option afer putting in an invalid
value, e.g. "abc" or "-20". Previously, the custom input showed
"NaN" in that case.
2024-12-31 16:51:59 -08:00
Anders Kaseorg
b19a556982 stream_types: Remove email_address from ApiStreamSubscription.
Commit 432001656e removed this from the
backend.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-30 09:42:26 -08:00
Anders Kaseorg
219c3b56df tests: Continue execution after blueslip.reset failures.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-18 21:39:22 -08:00
Aman Agrawal
525ae3aaff message_list: Fix message list missing messages.
Since we allow calling `add_messages` without checking fetch status,
it can lead to non-contiguous message history due to latest message
being added to a message list without previous messages being
fetched.

To fix it, we only allow adding new messages via message_fetch
which properly sets `anchor` to the last message in the list
before fetching and adding messages to the list.
2024-12-18 10:21:48 -08:00
aditya.chaudhary1558@gmail.com
08c8e40afa drafts: Remove feature for discarding drafts after 30 days.
This commit helps in removal of all the code and documentation
related to 30-day auto removal of draft that are saved.

Fixes #32176.
2024-12-17 11:54:10 -08:00
Karl Stolley
668cff365b recent_conversations: Use Intl.ListFormat rather than .join(", "). 2024-12-17 11:01:21 -08:00
Sahil Batra
1c933dd231 streams: Include only IDs in default streams data.
Clients do not need complete stream objects in the default
streams data since they already have that via streams and
subscriptions data.
2024-12-17 09:40:10 -08:00