Commit Graph

62459 Commits

Author SHA1 Message Date
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
evykassirer
7b932faf40 message_header: Use em instead of px for height and font-size. 2025-01-09 15:04:06 -08:00
evykassirer
f56f78ddb8 message_header: Remove unused recipient-row-stream-icon.
Removed in 12ac459379.
2025-01-09 15:04:06 -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
whilstsomebody
696a0ac8ef read_receipts: Auto-refresh read-receipts dialog every minute.
Previously, the read-receipts dialog did not update if
someone viewed the focused message while the dialog
box was open. Users had to close and reopen it to see
the updated receipts. Now, the dialog refreshes every
minute to keep the read-receipts updated while open.

Fixes: #24716.
2025-01-09 12:54:49 -08:00
Alya Abbott
34b7c6de2d help: Refresh email notifications help page.
Document more clearly when notifications are triggered.
2025-01-09 12:38:46 -08:00
Vishesh Singh
ba25648190 mention_pill: Fix spacing for bot icon in bot mention pill.
Added left margin to bot icon in bot mention pill.

Fixes #26831.
2025-01-09 12:28:16 -08:00
Vishesh Singh
b0aff47f52 left_sidebar: Show empty circle and bot icon for the bots.
In DMs, show a gray circle before the bot's name and a bot icon after.

fixes part of #28561.
2025-01-09 12:28:16 -08:00
Vishesh Singh
076774111f stream_settings: Display bot icon after bot name.
Render bot icon for bot users.

fixes part of #28561.
2025-01-09 11:58:20 -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
Mateusz Mandera
e41ee8abf5 streams: Tweak query in update_stream_active_status_for_realm.
The NOT EXISTS structure might be better optimized by the Postgres query
planner and might lead to slightly better performance than the id NOT IN
(<subquery>) structure.
2025-01-09 11:56:11 -08:00
Aman Agrawal
f7e02c51d2 narrow: Extract function to modify narrow before filtering messages. 2025-01-09 09:53:53 -08:00
Aman Agrawal
43f42364ff dialog_widget: Add option to avoid closing on completing API request. 2025-01-09 09:53:53 -08:00
Aman Agrawal
70d74e4d01 dialog_widget: Fix loading spinner not visible on submit button.
This can happen if `post_render` is called to show loading indicator
before the submit button is rendered. This results in the submit
button having no width / height dimensions.

Fixed by ensuring post_render is called post render.
2025-01-09 09:53:53 -08:00
Sahil Batra
9682e35584 settings: Show avatar by default in right sidebar for new orgs.
This commit sets the default for user_list_style to
USER_LIST_STYLE_WITH_AVATAR so that the organization
level defaults for new users of this setting is set
to show avatar in right sidebar for new orgs.
2025-01-09 09:19:22 -08:00
Alex Vandiver
a3a514e1c1 lightbox: Use original HEIC if the browser supports it. 2025-01-09 09:10:30 -08:00
Alex Vandiver
554e704c5a lightbox: Show transcoded high-resolution .webp for HEIC/TIFF images.
Fixes: #32587
Fixes: #24899
2025-01-09 09:10:30 -08:00
Alex Vandiver
bd2c934523 lightbox: Remove data-video-original-url; just use 'a href="..."' URL.
`data-video-original-url` is duplicative with the `href` on the
surrounding `a` tag, which is never run through the Camo URL
translation.  The `data-video-original-url` attribute was never
documented, and is not used by either mobile project, so is simply
removed.
2025-01-09 09:10:30 -08:00
Alex Vandiver
f868e6ed24 lightbox: Tighten type of Media.title. 2025-01-09 09:10:30 -08:00
Alex Vandiver
402a80d9f4 lightbox: Switch media type to an enum. 2025-01-09 09:10:30 -08:00
Alex Vandiver
bcaaddcc57 lightbox: Rename Payload to Media. 2025-01-09 09:10:30 -08:00
Alex Vandiver
a2ff78d134 lightbox: Document and clean up .url vs .source payload attributes.
The `.url` and `.source` fields were being inconsistently used.  This
also makes `.source` field consistently into a URL when it is
generated, instead of being re-interpreted in `display_video` for some
formats.
2025-01-09 09:10:30 -08:00
Alex Vandiver
230bae17bb thumbnail: Generate a transcoded high-res version of HEIC/TIFF images.
If the content-type of the image is not in INLINE_MIME_TYPES, then we
do not expect browsers to be able to display it.  This behaviour is
particularly confusing because the thumbnail will render properly,
since that will be in the more widely-supported WebP format, but the
lightbox will show a broken image.

In these cases, generate a high-resolution (4032x3024) "thumbnail"
which clients can choose to use instead.  This thumbnail format is not
in the listed in the server's advertised thumbnail size list, because
it is not reliably generated for every image.

The transcoded thumbnail format is set on the `img` tag if it is
generated, and the original content-type is always passed to the
client, so it can decide how or if to render the original image.  This
content-type is as the _original uploader_ specified it, so may be
incorrect.

The transcoded image is not animated, even if the original was.  HEIC
files can nominally be animated, but in testing libvips was not able
to correctly recognize them as such.  TIFF files are parsed as being
"animated," with one page per frame; this is of dubious utility, so
we merely transcode the first page.  Always generating a static
transcoded image serves to also limit the computational time spent.

THUMBNAIL_OUTPUT_FORMATS is switched to be a tuple to ensure that it
is not accidentally mutated.
2025-01-09 09:10:28 -08:00
Alex Vandiver
9fa5ab951c mime_types: Move INLINE_MIME_TYPES to prevent future import loops. 2025-01-09 09:09:13 -08:00
Sahil Batra
57079169d5 user-group: Show display name for system groups in membership status text.
This commit updates the code to show the display name for system groups
instead of their original names which contain "role:" prefix in
membership status text.
2025-01-09 09:05:43 -08:00
Sahil Batra
b4a5963389 user-groups: Show display name for system groups in members list.
This commit updates the code to show the display name for system
groups instead of their original names which contain "role:"
prefix in the members list shown in group edit and creation UI.
2025-01-09 09:05:43 -08:00
Shubham Padia
d1b277058a upload: Implement InMemoryUrlStorage for tus-js-client.
Fixes #31926.
The tus-js-client fingerprinting feature stores metadata on
previously uploaded files by default in browser local storage.
Since these local storage entries are never garbage-collected,
they can be accessed via the browser console even after
logging out, and contain some metadata about previously
uploaded files, which seems like a security risk for
using Zulip on a public computer.

We use our own implementation of url storage that saves urls
in memory instead. We won't be able to retain this history
across reloads unlike local storage, which is a tradeoff we
are willing to make.
2025-01-08 16:32:19 -08:00
evykassirer
c9ef9fdf78 polls: Use em for modal title. 2025-01-08 16:28:48 -08:00
evykassirer
3f1966ced9 polls: Remove bottom margin to fix vertical centering. 2025-01-08 16:28:48 -08:00
evykassirer
fe3d87f15e polls: Set modal height with em. 2025-01-08 16:28:48 -08:00
Lauryn Menard
e5bafb625b email: Update realm deactivation email for data deletion information.
Fixes #24686.
2025-01-08 16:27:11 -08:00
Prakhar Pratyush
dc35e79701 streams: Allow specifying sender during channel email generation.
This commit adds a `sender_id` parameter to the
`GET /streams/{stream_id}/email_address` endpoint to specify the
ID of a user or bot which should appear as the sender when messages
are sent to a channel using the channel email address.

Earlier, Email gateway bot was always the sender.

Fixes part of #31566.
2025-01-08 12:17:16 -08:00
Prakhar Pratyush
2bb4b70121 refactor: Separate get channel email token logic from email encoding.
This commit extracts the logic for creating or retrieving a channel
email token into a dedicated `get_channel_email_token` function.

This improves code clarity by decoupling token generation from
the email encoding process.
2025-01-08 11:29:54 -08:00
Aman Agrawal
864a2a067e recent_view: Fetch significant message history per Load more click.
Increase required messages significantly before stopping the backfill
every time `Load more` is clicked.
2025-01-08 10:56:14 -08:00
PieterCK
f89881d843 integrations: Change Slack private channel mention string.
In Slack webhook integration setup, the only scenario where a message
payload contains a channel mention without the channels name is when the
user mentions a private channel.
  e.g <#C07AVLQ3AUQ|>

This commit updates the string we use for such mention to "private Slack
channel" for better clarity.
2025-01-08 13:52:12 -05:00
PieterCK
059782bb9f integrations: Improve Slack integrations setup notification.
Previously, the notification message only informed users that the
integration URL was registered with Slack's Event API. However, it might
be misleading to send an "integration is successful" message when this
happens because we didn't verify that the token has the required scopes
or if the Slack token is even added to the URL at all.

Now that the integration also verifies the `slack_app_token`'s scope,
it's now more appropriate to send a notification message like
`get_setup_webhook_message` to let the user know that the setup is
indeed successful.
2025-01-08 13:52:12 -05:00
Harsh Bansal
b7599a41d8 left sidebar (ui): Change icon for browse channels.
- Replaces the magnifying glass icon with a new design that
  aligns better with the purpose of finding channels.
- Matches the "Browse Channels" link styling with the link at
  the bottom of the left sidebar for consistency

Fixes: #32914

Co-Authored-By: Vlad Korobov <terpimost@gmail.com>
2025-01-08 09:23:11 -08:00
Vector73
35c1cc4eae settings: Add checkbox for "realm_invite_required" permission.
This checkbox was accidentally removed in #32371.
2025-01-08 10:19:05 -05:00
whilstsomebody
f1dd8d88c9 compose: Add background and border colors for message limit.
Added colors to notify users when the message length is near
the limit or has exceeded it. Used distinct colors for each
case to provide clear feedback.

Fixes: #32171.
2025-01-07 17:57:15 -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
6a007d5088 stream_color: Hide stream popover when color picker popover is open.
This commit ensures that if the color picker popover is opened via the
stream actions popover, we hide the stream actions popover and instead
show the color picker popover in its place, anchoring to the same
reference element.

This avoids the cluttering of the view with multiple layers of UI,
given that it is also possible to open the browser native color picker
from the color picker popover.
2025-01-07 17:28:00 -08:00
Sayam Samal
c8de1debf8 stream_color: Remove spectrum-colorpicker library.
As a follow-up to the previous commit which replaces the spectrum color
picker instances with the custom color picker popover, this commit
removes the spectrum-colorpicker library and its related code from the
codebase.
2025-01-07 17:27:58 -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
Prakhar Pratyush
6cd1c34ae1 messages_in_narrow: Add support for empty topic name.
This adds support for empty topic name for
'/messages/matches_narrow' endpoint.

Makes sure that using this endpoint in old clients
with topic name having the value of `realm_empty_topic_display_name`
field in `narrow` parameter works as expected.
2025-01-07 17:24:00 -08:00
Prakhar Pratyush
526e23fc4a update_message_flags_for_narrow: Add support for empty topic name.
This adds support for empty topic name for
'/messages/flags/narrow' endpoint.

Makes sure that using this endpoint in old clients
with topic name having the value of `realm_empty_topic_display_name`
field in `narrow` parameter works as expected.
2025-01-07 17:24:00 -08:00
Prakhar Pratyush
1d1431297c initial_state_data: 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 backward compatibility for topic names in `user_topics`
objects returned in `/register` response.
2025-01-07 17:24:00 -08:00
Prakhar Pratyush
1a83c23c83 mark_topic_as_read: Add support for empty topic name. 2025-01-07 17:24:00 -08:00