Commit Graph

1016 Commits

Author SHA1 Message Date
Daniil Fadeev f2e627ba51 drafts: Move code handling keyboard navigation to a separate module.
The keyboard navigation that used to only work in drafts can now be
reused. This commit has moved the related functions to a separate
module.
2023-05-15 14:46:21 -07:00
Daniil Fadeev 35c23d0269 drafts: Refactor keyboard functions for reusability.
This is a preparatory commit to implement keyboard navigation in the
 message scheduling modal. The main goal is to make the
 `modals_handle_events` function reusable. To achieve this, we have
 extracted all the context-related variables and replaced all
 mentions of "draft" with the more neutral term "item". The
 `modals_handle_events` function now also has a context parameter,
 which contains all the necessary methods and properties to work in
 different modal contexts.
2023-05-15 14:46:20 -07:00
Aman Agrawal ae02a93d35 scheduled_message: Change tooltip of failure icon. 2023-05-15 14:43:04 -07:00
Aman Agrawal c375d36c9e css: Dim color of failed message sent icons. 2023-05-14 16:46:20 -07:00
Aman Agrawal 1bffdda59f scheduled_message_overlay: Add a failed delivery indicator.
Fixes #25501
2023-05-14 16:46:20 -07:00
Aman Agrawal 06cbe95583 scheduled_message: Extract common elements into a separate file. 2023-05-14 16:46:20 -07:00
Satyam Bansal fad5c88aa9 select_recipient_widget: Use "button" tag instead of "div".
Previously, hovering over the stream selector in the
compose box would show a mouse/text pointer instead
of a hand pointer.

Fixes #25592.
2023-05-14 16:35:48 -07:00
Lalit cab3a992c0 refactor: Extract `message_feed_loading` module from `message_scroll`.
This new module allows us to remove dependency on `message_scroll` in `fetch_status`
and hence allowing us to migrate it to TypeScript.
2023-05-14 11:24:31 -07:00
Lalit 9e1b4dafc0 message_list_data: Remove dependency on `filter.js`.
This commit removes dependency on `filter.js` by lifting the construction
of `Filter` object up in `all_messages_data.js`.
2023-05-14 11:24:31 -07:00
Ujjawal Modi fc22b86eb6 streams: Correctly disable adding subscribers while creating streams.
This commit disables the field used for adding other subscribers
in stream creation box for users who are not allowed to add
other users to streams because of realm level setting
"Who can add users to  streams".

Fixes #24900.
2023-05-14 11:19:41 -07:00
Ujjawal Modi 105acc8495 streams: Disable option to add other subscribers in existing streams.
This commit disables the field used for adding other subscribers
to existing streams for users who are not allowed to add other users
to streams because of realm level setting "Who can add users to streams".
2023-05-14 11:19:05 -07:00
Ujjawal Modi eda1ee555b streams: Properly disable add subscriber container for existing streams.
Earlier the field used for adding subscribers to existing
streams was not properly disabled.

This commit properly disables the field and also adds a new function
for enabling and disabling add subscribers container.
2023-05-14 11:19:05 -07:00
Aman Agrawal f66dde4a33 left_sidebar: Move tooltips to the `focus` element.
Since tippy relies on the `blur` event of `target` to hide
the toolips, it is important that the tooltip is triggered
by the element that receives that focus in keyboard navigation which
is `a` tag for left sidebar elements.
2023-05-12 17:35:52 -07:00
Alex Vandiver b20aeadcb8 sentry: Downsample typing spans.
These can come fast and furious, and are not worth reporting all of.
Like presence reporting, we leave a small percentage of them for
network and endpoint latency information.
2023-05-12 13:53:57 -07:00
Alex Vandiver 6a3f97ba80 sentry: Heavily downsample presence spans.
Instead of dropping all of these spans, downsample them heavily (1% of
expected sampling rate).  These are some of the most frequent requests
to the server, and the high volumes do not add much information.  We
leave a small percent of requests, since it is a useful measure of
overall client network latency.
2023-05-12 13:53:57 -07:00
Alex Vandiver 9912b4c815 sentry: Unify logic for skipping span reporting.
This changes to not report any `call POST /json/users/me/presence`
spans, which we previously reported despite not including the inner
auto-instrumented HTTP spans.
2023-05-12 13:53:57 -07:00
Tim Abbott 2b2ee686f3 portico: Extract CSS variable padded-content-padding. 2023-05-12 11:54:17 -07:00
Karl Stolley f1db7c1d72 portico_css: Keep targeted elements below menu bar.
This PR ensure that all elements targeted by URL fragments will
remain visible below the portico's menu bar at all viewport
sizes and also when a user zooms in, provided the target is on a
page with the menu bar, which will have the `portico-landing`
class.

Whether a quirk or a bug, Chrome appears to ignore the padding on
ancestral containing elements when calculating the offset for
`scroll-margin-top`, which is why padding has been moved to
`.inner-content` for `.why-page` and `.case-studies-page`, which
are the two unique class names for portico pages where the targeted-
element scrolling behavior is used.
2023-05-12 11:54:17 -07:00
Karl Stolley a5ff3d7e59 portico_pages: Add uniform structure HTML structure.
This commit ensures that the Attribution, Jobs, and Team pages all
share a uniform structure to match those of other pages. This will
simplify styling and should ensure greater confidence when modifying
portico landing-page styles.

The one CSS modification here, for the jobs page, maintains the space
at the top of the "How we work" section.
2023-05-12 11:54:17 -07:00
Aman Agrawal dd73f7272d recent_conversation: Fix incorrect `if` condition.
row_focus cannot be equal to `$topic_rows.length` since it follows
0 array indexing.
2023-05-12 11:32:40 -07:00
Hardik Dharmani 0738dfd126 edit_bot_modal: Keep Save Changes button disable until changes are made.
Use update_submit_disabled_state_on_change parameter of dialog_widget
instead of setting up input handlers in show_edit_bot_info_modal.

Added new hidden input field to store value of current selected option
in edit_bot_form.hbs whose value is updated by item_click_callback
function of in settings_bots.js.

Also, called $(".edit_bot_avatar_file_input").trigger("input") on
clearing avatar so input event handler gets called and compare the
values to disable the submit button again.

Fixes #24568
2023-05-12 11:30:50 -07:00
Hardik Dharmani 81dfaa0602 dialog_widget: Update `get_current_values` function.
Updated `get_current_values` function to not include undefined keys
in current_values object and if the input field is of type file and
a file is selected then set the value equal to file object.
2023-05-12 11:30:50 -07:00
Aman Agrawal 461d935463 css: Fix unread marker leaking through message header. 2023-05-12 11:13:20 -07:00
Anders Kaseorg ea28083ba4 eslint: Fix unicorn/prefer-at.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-12 11:12:20 -07:00
Anders Kaseorg 54f90e41c0 eslint: Fix unicorn/prefer-string-replace-all.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-12 11:12:20 -07:00
Tim Abbott fe54df0b01 css: Darken light theme message feed borders.
This was a design bug caused by Figma's grey background.

https://chat.zulip.org/#narrow/stream/101-design/topic/UI.20redesign.3A.20background/near/1567435
2023-05-11 16:05:05 -07:00
Hardik Dharmani ede1e547ee stream_settings: Fix bugs with #stream-creation .modal-footer.
This commit addresses `#stream-creation .modal-footer` becoming
transparent after an error in creating a stream due to overlapping
with `.stream-creation-body`. Instead of adding data-simplebar on
.stream-creation-body, added it to a new div
`stream-creation-simplebar-container` which contains 3 divs:
stream_create_info,stream_creating_indicator and stream-creation-body.

Additionally, fixed the border-radius of the modal footer on the
bottom left side for device width > $md_min.

Fixes #25526
2023-05-11 15:50:56 -07:00
Anders Kaseorg 362556b540 app: Use ES module from flatpickr.
https://github.com/flatpickr/flatpickr/issues/2468 was fixed in
flatpickr@4.6.10.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-11 14:50:37 -07:00
Anders Kaseorg 5173511e77 debug: Remove print_elapsed_time in favor of console.time.
https://developer.mozilla.org/en-US/docs/Web/API/console#timers

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-11 14:49:55 -07:00
Aman Agrawal 35278a74bb css: Fix highlighted stream color with keyboard navigation.
Instead of highlighting the topics of the `active-stream`, we
highlight the stream name.
2023-05-11 12:44:23 -07:00
Aman Agrawal 232543d425 billing: Making /upgrade page header visible.
This was hidden following #25518
2023-05-11 11:30:31 -07:00
Karl Stolley 1d5e026b66 left_sidebar: Adjust size and position of DM icons. 2023-05-11 10:53:03 -07:00
Joelute 99dbea3331 narrow_banner: Drop empty action line from empty `dm-including:` views.
Previously, when a user enters a empty dm-including view, they'll notice
the "Why not start the conversation" action line and click on the link.
When this happens, the compose box would open but the receipent box is
never populated.

Since the dm-including view is a search view, we should drop that phrase
from dm-including views altogether. It also isn't super natural to
have a button that starts the conversation with the user anyways.

Fixes: #25524.
2023-05-10 18:07:53 -07:00
Tim Abbott 1514d651f4 compose_banner: clear_all shouldn't remove simplebar.
Simplebar introduces a bunch of intermediate divs, and we want to be
clearing the content element, not the entire container including the
simplebars divs.
2023-05-10 17:54:28 -07:00
Lalit 407629b46c compose_banner: Add `update_or_append_banner` method in `compose_banner`.
`update_or_append_banner` abstracts the logic for not creating another compose
banner if one is already present in the DOM, it just replaces the content of the
old banner with the new one.
2023-05-10 17:54:28 -07:00
Lalit 577c150ffa compose: Open send later modal when user accepts the warning on scheduling message.
When the user has a wildcard @-mention we show a warning if the stream has more than
15 members. When the user clicks "Yes, schedule" and confirms the intend to schedule
the message we open the send later modal to let user choose scheduling time.

Fixes #25426.
2023-05-10 17:54:28 -07:00
Lalit 87397ed000 popover_menus: Extract `open_send_later_menu` function.
Extracted opening send later menu code in its own function `open_send_later_menu`
so that we can reuse to directly open the modal from different parts of code.
2023-05-10 17:54:28 -07:00
Lalit c2b1463224 compose_validate: Accept `scheduling_message` argument in show_wildcard_warnings.
Added a new param `scheduling_message` which is passed down to the `show_wildcard_warnings`
this argument will help us to do logic relevant to when we are doing validation on scheduling
a message.
2023-05-10 17:54:28 -07:00
Tim Abbott f6dde97ec9 popovers: Fix 'u' keyboard shortcut on messages without avatars.
In ab0c5f3092, it was missed that this
code depended on the sender_info_hover CSS class, which is no longer
an empty element on messages without a message sender avatar/name
element.

The logic is still hacky, as it relies on the position of an invisible
element, but we're rewriting the positioning logic using Tippy anyway,
so it's not worth doing much to make it nicer.

Fixes #25496.
2023-05-10 17:38:46 -07:00
Tim Abbott 59daf54ec9 scheduled_messages: Fix broken node test.
This test just used the current hour, and thus would always fail at
24:00 UTC.
2023-05-10 17:06:59 -07:00
Daniil Fadeev e10997b0e6 scheduled_messages: Rerender send later options at specific time.
Fixes: #25451.
2023-05-10 16:14:10 -07:00
Daniil Fadeev 45c3f8aa96 send_later: Extract send later options to separate template.
This is a preparatory commit that will help to render the options
for the send-later modal separately. This is necessary to have
actual sending options if the user keeps the modal open.
2023-05-10 16:14:10 -07:00
Lalit ebaabc6b68 ts: Migrate `feedback_widget` to TypeScript.
This commit migrates `feedback_widget` module to TypeScript.
2023-05-10 14:31:42 -07:00
Trident Pancake e52eee330c message_edit: Avoid registering duplicate events.
Fixes #25462.

hotkey.js is the file that handles the 'e' keyboard shortcut. It maps to the
'edit_message' event and will simply call message_edit.start().

message_edit.start() doesn't check whether it's already been opened previously,
so it will go through and try to register handler for the clipboard button
again. When the clipboard button gets clicked, the handler will be called
twice. Once with a properly target element, and once with null.

Fix this issue by checking if message_edit.start() has already operated on
the given $row.
2023-05-10 14:09:19 -07:00
Joelute 2b93b2eb98 bootstrap: Remove unused stylings for `btn-info`.
Currently, we are in the process of removing bootstrap out of the current
Zulip codebase. A quick git grep on btn-info shows that the class is only
used in `templates/corporate/billing.html`. But it doesn't take advantage
or use most of the styling rules that are set.

We should get rid of those rules as it's not being used and help simplify
the process in removing bootstrap.
2023-05-10 12:10:14 -07:00
Aman Agrawal 012f91eaba dropdown_widget: Show "No search results" instead of an empty list. 2023-05-10 12:00:18 -07:00
Aman Agrawal 0e79689c72 dropdown_widget: Move to last item on arrow up on search box. 2023-05-10 12:00:18 -07:00
Aman Agrawal 5156f465ef css: Increase max-height so that no element is partially visible.
I didn't want to use JS for it since calculating height based on
item height before rendering the dropdown is expensive and after
rendering the dropdown will cause it jump.
2023-05-10 12:00:18 -07:00
Aman Agrawal 79b00d3c2a minor: Correct comments. 2023-05-10 12:00:18 -07:00
Aman Agrawal 781a22bf81 dropdown_widget: Improve arrow navigation experience.
After `ArrowDown` on the last visible, don't jump the next item
into the center of the view, instead align the bottom of the item,
to the bottom of the visible container.
2023-05-10 12:00:18 -07:00
Aman Agrawal 393bcb4a9a compose: Increase font size of recipient privacy icon. 2023-05-10 12:00:18 -07:00
Aman Agrawal 4f8424b63b scheduled_message: Hide success compose banner on `remove` event.
Fixes #25441

`remove` event is triggered when scheduled message is sent and
when the scheduled message is removed, so this will remove
success banner in both cases.
2023-05-10 11:53:22 -07:00
Aman Agrawal 4f6af93f5d overlays: Add method to check if the correct modal is open.
This will be used to avoid this code syntax:
```
if (overlays.is_modal_open()) {
   overlays.close_modal("send_later_modal");
}
```
2023-05-10 11:10:32 -07:00
Tim Abbott 6e0ea3d79a message_edit: Avoid confusing notice editing wildcard mention messages.
It's highly confusing to suggest to a user that we'll send a second
notification to all users when that's not the case.

Fixes #25507.
2023-05-09 23:05:04 -07:00
Tim Abbott 859a96e0d7 message_store: Keep track of wildcard_mentioned.
We'll need this to check if a message already had a wildcard mention
in the message edit code path.
2023-05-09 23:05:04 -07:00
Daniil Fadeev dd65ec2916 compose: Validate stream message mentions on edit save.
This commit adds a message mentions validation for message editing.
The behavior will be similar to the validation on the compose box
when the user sends a message.

Fixes: #25411.
2023-05-09 23:05:04 -07:00
Daniil Fadeev 1bab164d39 compose: Simplify `user_acknowledged_wildcard` to a Boolean. 2023-05-09 23:05:04 -07:00
Daniil Fadeev f914e2a54e compose: Remove the global variable for wildcard mentions. 2023-05-09 23:05:04 -07:00
Daniil Fadeev 209e9edd9d compose: Add container parameter to functions.
This commit introduces a new container parameter for functions that
can be used for both compose and edit mode. It provides the function
with information about the context in which it is being used.
2023-05-09 23:05:04 -07:00
Daniil Fadeev 815aeccd04 compose: Create a helper function to calculate input information.
Function retrieves the input information based on the target event
and returns it as an object. It determines if the input is an edit
form or a compose form and returns the appropriate banner container.
2023-05-09 23:05:04 -07:00
Daniil Fadeev e22c44131b compose: Use the passed container value to remove the banner. 2023-05-09 23:05:04 -07:00
Sahil Batra 0ec16407ba invite: Add checkbox to select all default streams.
We now add a checkbox in "Steams they should join" to directly
select all default streams in the realm for the invite.
We hide the stream list if that option is selected.
2023-05-09 17:05:18 -07:00
Sahil Batra 4ca887bade invites: Allow users to invite without specifying any stream to join.
We now allow users to invite without specifying any stream to join.
In such cases, the user would join the default streams, if any, during
the process of account creation after accepting the invite.

It is also fine if there are no default streams and user isn't
subscribed to any stream initially.
2023-05-09 17:05:17 -07:00
alik-balika c0560b3ea9 about_zulip: Change icon color when copy button is hovered.
`Version` and `Forked from` copy buttons in the "About Zulip" UI
will now change color when hovered over.
This allows the copy button to pop out more when hovering over it.

Fixes part of #23210.
2023-05-09 16:32:06 -07:00
Aman Agrawal df6c47565f css: Increase border opacity for message header and content. 2023-05-09 16:25:28 -07:00
Aman Agrawal ddc1406090 css: Fix unread indicator being partially displayed on date_row.
Add a border to the left of date row to override the unread
indicator.
2023-05-09 16:25:28 -07:00
evykassirer c578a38423 navbar: Widen navbar to fill the full screen on large screens.
Now that the navbar is a different color, we want it to also
take up the full width of the screen. Because the navbar has
margin, this commit adds a new div. To not have to add a new
div, the scrollbar would need to be moved to the `html`
element, which is a bigger project.

This commit also moves the zulip logo to be left-justified instead
of centered, since it looks strange centered with the full
width navbar.
2023-05-09 16:25:28 -07:00
evykassirer e026aa1217 UI redesign: Change background color.
Fixes: #21750
2023-05-09 16:25:28 -07:00
Tim Abbott 77ac1a10de compose: Collapse recipient widget with few options.
This looks visually nicer, and I think is necessary to merge it for
now, but I'm doing this as a separate commit so it's easy to revert if
we change our mind.
2023-05-09 14:11:26 -07:00
Aman Agrawal d64ad8653b edit_bot_form: Use new tippy dropdown for selecting bot owner. 2023-05-09 14:11:26 -07:00
Aman Agrawal 8ea59f7f02 compose: Use tippy for stream select dropdown.
Fixes #25434
2023-05-09 14:11:26 -07:00
Aman Agrawal a196b949f7 dropdown_widget: Implement dropdown widget using tippy.
This will soon replace DropdownListWidget.
2023-05-09 14:11:26 -07:00
Hardik Dharmani bb78d9741f move_modal: Focus input in "Move messages" and "Move topic" modals.
If user has permissions to move the message(s) to a different stream
and can't edit topic name then focus stream input; else, focus topic
input on "Move messages" and "Move topic" modals render by
`ui_util.place_caret_at_end($(".move_messages_edit_topic")[0])` to
position the cursor at end on focus.

Wrapped if else logic in function focus_on_move_modal_render()
and passed it to on_shown parameter of dialog_widget.launch()
to focus stream/topic input once widget is rendered.

Fixes #24805
2023-05-09 13:51:07 -07:00
Hardik Dharmani cfbcbe901a topic_edit: Rename `inline_topic_edit` to `move_messages_edit_topic`.
In move_topic modal, Renamed inline_topic_edit to
move_messages_edit_topic to be more specific selector as
inline_topic_edit is also used in message header.

Additionally, Removed id inline_topic_edit as it was only used
in zulip.css instead used `.inline_topic_edit` selector as that
element also have class with same name inline_topic_edit.

Fixes #24805
2023-05-09 13:51:07 -07:00
Tim Abbott e0f6a7a48d scheduled_messages: Avoid hardcoding minimum delay.
This deduplicates the 5 minutes calculation across the scheduled
messages code path.
2023-05-09 13:48:28 -07:00
Hardik Dharmani 697cdb31e5 message_headers: Abbrevate direct message recipient names.
Abbrevated DM recipient names in message feeds, Drafts and Scheduled
messages overlays by wrapping recipient names in span with class
private_message_header_name and applying `overflow: hidden` and
`text-overflow: ellipsis` CSS to it.

Fixes #25353
2023-05-09 13:43:40 -07:00
Hardik Dharmani 99a988e220 message_header: Abbreviate topic names in all overlays.
Fixes #25353
2023-05-09 13:43:40 -07:00
Alex Vandiver 64b277d845 blueslip: Reduce cardinality of blueslip.error() calls.
Particularly when grouping in Sentry, pushing the ids and such into
the additional data section helps group like errors together better.
2023-05-09 13:16:28 -07:00
Alex Vandiver 1769f981da blueslip: Show more-info context in alert popup, if we have it. 2023-05-09 13:16:28 -07:00
Alex Vandiver 5d97dbf8b3 zblueslip: Show chained causes in unexpected messages. 2023-05-09 13:16:28 -07:00
Alex Vandiver fa92895731 blueslip: Support nested Error objects by .cause. 2023-05-09 13:16:28 -07:00
Alex Vandiver 8e3a6d17bd blueslip: Move BlueslipError into blueslip_stacktrace.ts.
Its existence is purely to add more context when displaying the
stacktrace.
2023-05-09 13:16:28 -07:00
Alex Vandiver 591b800ba4 blueslip: Pass original exception down into BlueslipError, if present. 2023-05-09 13:16:28 -07:00
Alex Vandiver 7898818983 blueslip: Pass the Error around, rather than re-creating a dummy one. 2023-05-09 13:16:28 -07:00
Alex Vandiver 52c613471a blueslip: Add a more specific type. 2023-05-09 13:16:28 -07:00
Alex Vandiver 086e64dfe4 blueslip: More tightly annotate more_info. 2023-05-09 13:16:28 -07:00
Alex Vandiver fea5a3fdb8 sentry: Always capture an Error, rather than a string.
We pass the original exception down as the `cause`, if present.  This
makes Sentry properly capture the callstack.
2023-05-09 13:16:28 -07:00
Alex Vandiver 9d6ca32c59 sentry: Annotate all channel calls. 2023-05-09 13:16:28 -07:00
Alex Vandiver c67cd5adb4 sent_messages: Remove from cache when message has been fully received.
There is no reason to keep these messages in a local memory store once
we have completed sending them and seen their events.
2023-05-09 13:16:28 -07:00
Alex Vandiver 3cc2adcd3b sentry: Switch to using Sentry spans for message send timings. 2023-05-09 13:16:28 -07:00
Alex Vandiver 00ea197744 sentry: Switch to using Sentry spans for narrow/unnarrow timings. 2023-05-09 13:16:28 -07:00
Alex Vandiver 3ab22233f0 sentry: Add tracing extensions when Sentry is not enabled. 2023-05-09 13:16:28 -07:00
Alex Vandiver 8089cb70dd sentry: Don't create spans for the longpoll or presence.
These will help Sentry skip span creation for these requests, which
are background events and not part of the pageload time.
2023-05-09 13:16:28 -07:00
Alex Vandiver 37c3cfb348 sentry: Do not start a navigation transaction on hash change. 2023-05-09 13:16:28 -07:00
Alex Vandiver 768ab19cd3 sentry: Do some basic URL client-side aggregation.
Doing client-side aggregation is better than letting Sentry try to
guess the grouping.  While ideally this would be generated from the
Django routes, automatically parsing those to generate a route map is
quite difficult.  We include basic numerical groupings, as well as the
few paths which have Confirmation objects.
2023-05-09 13:16:28 -07:00
Alex Vandiver bfdc057e3a sentry: Tag JS reports with the user's role.
User attributes are not indexed and searchable, unlike tags.
2023-05-09 13:16:28 -07:00
Alex Vandiver e2a6a0c440 sentry: Stop importing from `@sentry/tracing`, which is deprecated.
This was deprecated in 7.47.0[^1].

[^1]: https://github.com/getsentry/sentry-javascript/releases/tag/7.47.0
2023-05-09 13:16:28 -07:00
Alex Vandiver a9f51a0c02 static: Add Timing-Allow-Origin: * to allow sentry data timing.
This is required for the browser to provide detailed timing
information about resource fetches from other domains[^1].

[^1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Timing-Allow-Origin
2023-05-09 13:16:28 -07:00
Hardik Dharmani 3a358a9a11 tooltips: Shift all tooltip templates to tooltip_templates.hbs.
Refactored all tooltip templates with static content to be in
tooltip_templates.hbs to avoid duplicate IDs and DOM element.

Fixes #25324
2023-05-09 11:10:58 -07:00
Hardik Dharmani 7ccfed65e8 tables: Fix table column dimensions on hover. 2023-05-09 09:41:34 -07:00
Joelute 245c855376 user_setting: Update wording for "Mark messages as read on scroll" setting.
Previously, the user setting "Mark messages as read on scroll" sounded
quite awkward and possibly confusing at times. We should update the text
to something more clear and concise. This change will change "Mark messages
as read on scroll" to "Automatically mark messages as read".

The help center article is also fixed to name which setting is being
adjusted.
2023-05-08 15:49:47 -07:00
Tim Abbott 9e5c1eff4b scheduled messages: Fix incorrect mapping of 4PM to 16:00 hours. 2023-05-08 15:10:52 -07:00
Karl Stolley 466422800a scheduled_messages: Allow Today scheduling thru :54 past the hour.
This PR allows users to schedule Today messages from the modal opts
thru 8:54am (8:54) for sending at 9:00am, and thru 3:54pm (15:54) for
sending at 4:00pm. (That's including up to :59 seconds, of course, on
:54 after. So, XX:54:59.)

We also correct tests that were verifying incorrect logic of expecting
a 2PM cutoff, when we intended 4PM.

Fixes first part of #25451.
2023-05-08 15:10:52 -07:00
Karl Stolley a318e7cbf4 scheduled_messages: Don't offer to reschedule in the past.
This introduces a function that checks for both the existence and the
expiration of the `selected_send_later_timestamp`.

The logic it supports prevents users from scheduling a message to send
in the past or less than five minutes into the future at the level of
the UI (specifically the popover on the \vdots component of the Send
button). That can happen if a user attempts to edit a previously
scheduled message.

Fixes #25439.
2023-05-08 15:10:52 -07:00
Joelute 90bf36887a unread_banner: Update link on unread banners to direct users to setting.
Previously, the link on the unread banners redirected users to the help
center, instead we should change it so that it opens the display settings
up.
2023-05-08 15:00:20 -07:00
Joelute 9cabdf2033 dark_theme: Add dark themed colors to notice/info banners.
Previously, infomational banners didn't have any dark theme stylings which
resulted in a messy and terrible contrast with the dark themed app. These
changes adds those missing styles and uses the same stylings and colors
as the compose banners. Thus, making a definite improvement then before.
2023-05-08 15:00:20 -07:00
Joelute 17252cc526 popover: Allow message actions menu to support larger max-width.
Previously, the option texts were split into 2 lines due to the lack of
space in the message menu. We want to fix this by increasing the max-width
of the menu so it can support the entire text in 1 line while also providing
additional space for longer text.

Since, 320px is the maximum supported supported width for mobile, we will
allow the max-width value to flex from 320px to 350px depending on the
window_width
2023-05-08 11:28:45 -07:00
Tim Abbott a97c4708e8 message_list: Fix incorrect fetch_status check.
Fixes a typo introduced in 2084a91af9.
2023-05-08 10:48:54 -07:00
Aman Agrawal c756e950c7 tippyjs: Hide recipient bar tooltips on msg_list rerender.
I noticed a floating "Go to direct message ..." on chat.zulip.org,
and then found out that these don't use message_list_tooltip.
2023-05-08 09:47:38 -07:00
Karl Stolley 8447aa747c scheduled_messages: Explicitly pass date to compute_send_times(). 2023-05-07 11:57:20 -07:00
Karl Stolley 3e2422c8fe scheduled_messages: Prepare proper sending timestamps in Node test.
This corrects the scheduled message test to ensure that each relative
day (today, tomorrow) has the correct GMT timestamp for 9am and 4pm.
2023-05-07 11:57:20 -07:00
Hardik Dharmani b9611489ca node_tests: Extend unread.test.js to catch private message mentions bug.
In the "mentions" test, an additional unread message with the type
"private" and directly mentioning me has been added. This test case
checks for the scenario when the stream_id is null during the
reverse_lookup, which would have caused the test to fail before the
bug fix was implemented which now passes after the fix is applied.
2023-05-05 16:27:03 -07:00
Akarsh Jain b063779800 settings: Hide "Add a new emoji" button for unauthorized users.
This commit fixes the issue where the "Add a new emoji" button
was being displayed for users who did not have the necessary
permissions to add emojis. With this fix, the button will no
longer appear for unauthorized users, aligning with the
current behavior for bots and user groups.

Fixes #24918.
2023-05-05 16:22:24 -07:00
Tim Abbott 4566695b9d message_events: Clarify moved_message variable name. 2023-05-05 16:18:36 -07:00
Tim Abbott f9f68de0ac messages_events: Rename messages_to_rerender. 2023-05-05 16:18:36 -07:00
Sahil Batra 3992db5a19 message_edit: Editing topic from message header should move all messages.
Editing topic from message header should now move all the messages in
the topic and not just the messages below the recipient bar.
2023-05-05 16:18:36 -07:00
Sahil Batra 146f78a83d message_fetch: Return "first_unread" as backfill anchor for empty list.
We now return "first_unread" as anchor from get_backfill_anchor in
case when the message list is empty instead of throwing an error.
Doing this, would just result in fetching the messages normally like
it happens when a user narrows to a stream by clicking on it from
sidebar.

This also helps us handling the case, when all messages in the
current stream narrow are removed due to moving them, by fetching
the other messages from server for that stream narrow.
2023-05-05 16:18:36 -07:00
Sahil Batra 168680af23 message_events: Update code to handle messages not available locally.
Previously, if the client recieved an "update_messages" event with
"message_id" not present locally, then the event was completely
ignored. But, this can happen when moving messages especially
when doing a partial move due to time limit error.

This commit updates the code to have the code which requires the
message to be present locally run only if it is present instead
of just ignoring the event completely such that the updates for
moving the messages can be done.
2023-05-05 16:18:36 -07:00
Tim Abbott 57a89e5228 message_events: Fix buggy reuse of msg local variable.
The loop through the event_messages list, as well as a few smaller
loops, used this same variable name.
2023-05-05 16:18:36 -07:00
Karl Stolley 5113f4e2e9 scheduled_messages: Render localized, streamlined modal opts.
This commit ensures that user-locale and 24-hour preferences are
respected in the message-scheduling modal. It also simplifies the
translation of text strings in the scheduling modal.

Available scheduling options and their time values, including whether
the options are allowed, are now calculated every time a user opens
the scheduling modal.

In order to achieve those things, additional interrelated fixes here
accomplish the following:

1. Modal-scheduling opts now have data- attributes containing
timestamps for the time a message will be scheduled to send.

2. With those timestamps in place, the logic for setting the
scheduled send-time is simplified.

3. There are no more `send_later_xxx` global variables in the
`schedule_send` module.

Fixes #25403.
2023-05-05 14:00:46 -07:00
Daniil Fadeev 96680e95fb message_edit: Display the error banners in the correct place.
Fixes: #25412.
2023-05-05 13:43:10 -07:00
Daniil Fadeev 0756ac9250 channel: Refactor xhr_error_message to accept message optionally. 2023-05-05 13:43:08 -07:00
Lauryn Menard a93598c22e narrow: Do not mark as read when narrowing by topic or recipient.
Previously, we've been assuming that when a user narrows to a topic
or recipient, that the target message would be marked as read in
resulting view. This is no longer a safe assumption because a user
can have their personal display settings to never mark messages as
read, even in conversation views.

Removes the call to `unread_ops.notify_server_message_read` in
both `narrow.by_topic` and `narrow.by_recipient` in the web app.
2023-05-05 13:36:31 -07:00
Aman Agrawal 36cb0f8a61 scheduled_messages: Don't narrow to recipient on "Undo".
Fixes #25401

We no longer try to narrow to the recipient of the scheduled
message when processing `Undo`. This does not affect editing
via scheduled messages overlay.
2023-05-05 12:54:35 -07:00
Karl Stolley 715fa3aff6 scheduled_messages: Extract options logic from popover.
This commit extracts date-based logic from the popover menu file and
puts it in with the scheduled-messages logic.

The aim is for greater testability, with some initial tests now
presented on the date-based logic.
2023-05-04 13:52:22 -07:00
Karl Stolley ac0bd7bb7d scheduled_messages: Show Monday option on Fridays and Saturdays.
On Fridays and Saturdays, users will be presented with the option
to schedule a message to send on Monday at 9:00 am.

Fixes: #25402.
2023-05-04 13:52:22 -07:00
Tim Abbott 2084a91af9 message_list: Don't show empty narrow message unless certain. 2023-05-03 18:40:59 -07:00
Tim Abbott 9a8749ea8f message_fetch: Fix stream narrows when everything recent is muted. 2023-05-03 18:40:59 -07:00
Tim Abbott f1033a2326 message_fetch: Avoid calling process_result for failures.
I can't see any reason why it'd make sense to call a bunch of
functions designed to process newly arrived messages with an empty
list of messages to handle a 400 error from the server.

As best I can tell, the only part of this that was useful is showing
the appropriate empty narrow message.
2023-05-03 18:40:59 -07:00
Tim Abbott fa1067ec36 message_fetch: Move connection error hiding logic.
Containing all the message_fetch logic for #connection-error inside
load_messages is considerably more readable, and will help with being
able to clean up the process_result hack.
2023-05-03 18:40:59 -07:00
Tim Abbott 4e6b27b25f message_fetch: Avoid double-fetching muted topic messages.
Previously, when backfilling in a stream narrow (the main situation
where _items != _all_items), we would double-fetch any muted messages
older than the oldest message not hidden due to topic or user muting.

We change the all_messages fetch to use this function even though it
doesn't matter, just for clarity about the intent.

Since this bug could have prevented making progress fixes a
theoretical bug that could result in the client trying to fetch
messages for a given narrow indefinitely.
2023-05-03 18:40:59 -07:00
Tim Abbott 1ce17f7403 message_list: Fix incorrect usage of visible empty check.
The core logic for deciding whether newly fetched messages should be
prepended, appended, or inserted between existing messages was wrong
in the case that the message list was only visibly empty, but its
data structures contained some muted messages.

In particular, the _all_data data structure would end up having items
appended when they should be prepended; while this would eventually be
corrected if a rerender triggered a sort, it was a data corruption
with unknown secondary consequences, and in particular would mess up
any logic correctly using the first/last elements in _all_data.

Fix this by doing all of the logic using functions accessing
_all_items.  While doing so, we simplify the logic by removing the
unnecessary special case for empty message lists, including the
parallel filter_incoming function, which added extra complexity that
should always produce the same result.

The message_list.empty helper wraps this method, and thus is corrected
as well.
2023-05-03 18:40:59 -07:00
Tim Abbott 23eaa87635 message_list_view: Fix exception prepending when visibly empty.
In an upcoming commit, we will fix a bug that caused the
message_list_data system to append rather than prepending when
previously all the messages in a message list were hidden due to
topic/user muting.
2023-05-03 18:40:59 -07:00
Tim Abbott 804f473214 message_list: Extract visibly_empty helper method.
This function will allow us to adjust the codebase to write what it
means semantically -- whether a check is for the message list being
visibly empty, or completely empty.

In this commit, we leave the .empty() method incorrect, because
several other adjustments need to be made atomically with fixing it.
2023-05-03 18:40:59 -07:00
Tim Abbott 8f1c3a0fa1 message_list: Fix selecting the first message when previously empty.
There two situations where we might add messages to a previously empty
message list. The first is when a new message comes in; in that case,
the previous logic of just selecting the first message would work.

But in the case where we're instead adding a bunch of (previously
read) messages via a backfill API request, which can occur in a few
cases, including a stream narrow where all the topics with recent
messages are muted, we should use our standard rules to pick a message
to select, namely the first unread message (if any) or last message if
none are unread.
2023-05-03 18:40:59 -07:00
Anders Kaseorg 1331f07521 unread_banner: Fix awkward phrasing and split infinitive.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-03 17:08:22 -07:00
Tim Abbott d24e81e1b2 unread: Fix exception handling mentions in private messages.
Private messages with mentions are included in
unread_mentions_counter, but of course don't have a stream ID, so
should be skipped when calculating which streams contain unread
mentions.

This code has always been wrong, it put `undefined` in the set of
stream IDs with unread mentions.

What changed recently is that in
98162b7a3a, we started using the
`stream_id` to do an additional lookup in the unmuted version of the
function, and doing that lookup with `undefined` threw an exception.
2023-05-03 13:29:41 -07:00
Tim Abbott 976b0662ea top_left_corner: Fix new mention animation when loading app.
Apparently some past refactor caused the animation for new mentions to
be triggered when initialization the app.

(This seems pretty clearly unintentional: A user loading the app
doesn't need their attention specifically drawn to the @-mentions view
in the same way that a user who is using the app and receives a
mention right now does.)
2023-05-03 11:12:52 -07:00
Lauryn Menard a85492ac49 scheduled-messages: Remove unused `send_later_custom` template variable.
In commit e89cbf0ac1, the only use of this template variable was
removed from `send_later_popover.hbs`.
2023-05-03 11:09:46 -07:00
Hardik Dharmani 8829190ec6 unread: Deduplicate the logic for adding up unread counts.
Deduplicated logic for calculating unread message counts and
stream counts for subscribed streams by refactoring `get_counts` to
use `get_stream_count` function for calculating unread message counts
for each subscribed stream.
2023-05-02 15:43:29 -07:00
Aman Agrawal 770a789651 hashchange: Hide popovers on change in hash.
Fixes #24641

When the user clicks on a link which has `stopPropagation`
and doesn't trigger `scroll`, then we don't hide any existing
popovers if the element being clicked doesn't hide popovers
explicitly.

To fix this, we hide all popovers on change in hash which makes sense
on its own given how we use hashes.
2023-05-02 15:41:37 -07:00
Karl Stolley cfbfc37927 scheduled_messages: Hide Scheduled messages on 0 count.
This commit introduces structures and logic to hide the Scheduled
messages item from the left sidebar if there are no messages
scheduled to be sent.

Test coverage has been added for counts and visibility, too.

Fixes: #25101
2023-05-02 15:26:33 -07:00
Karl Stolley 2d9cbfa8f1 scheduled_messages: Add left sidebar count.
This commit introduces logic to present a message count with the
Scheduled messages item in the left sidebar.

The count is present on the initial load, and is updated as a user
adds or removes scheduled messages.
2023-05-02 15:26:33 -07:00
Daniil Fadeev 6dc10f8696 compose: Pass a container to which the banner should be applied.
This fixes banners related to message editing incorrectly appearing
next to the compose box.

Fixes: #25230.
2023-05-02 14:09:09 -07:00
Tim Abbott c70910b5dc upload: Fix close widget in edit form banners not working.
The selector was wrong, but the logic also created a bunch of
duplicate click handlers.
2023-05-02 14:09:09 -07:00
Daniil Fadeev 394b3586b9 compose: Add a helper function to find the banner container. 2023-05-02 14:09:09 -07:00
Daniil Fadeev 3b35307c20 compose: Add option to specify container for appending banners. 2023-05-02 14:09:09 -07:00
Tim Abbott d96fac2b59 compose: Fix compose banner click handlers when editing messages.
The click handlers for compose banners, many of which can appear both
in the message editing code path and above the compose box, were
incorrectly scoped to only the #compose_banners container.

These click handlers were all overly specific; they already have a
very unique selector in the form of things like
.compose_banner_close_button, and more shouldn't be necessary.
2023-05-02 14:09:09 -07:00
Hardik Dharmani 3d3d30166d tooltips: Update content of `Narrow-to` toolips. 2023-05-02 13:50:46 -07:00
Hardik Dharmani 03cfb3d9fe tooltips: Add `S` hotkey hint to `narrow-to` tippy tooltips.
Added hotkey hint to Narrow to stream/topic/DM tooltips by creating
new tippy for `tippy-narrow-tooltip` with LONG_HOVER_DELAY which
appends `S` hotkey to the existing tippy content set by
data-tippy-content attribute on the element.

Using this approach instead of a <template> with
data-tooltip-template-id avoids issues with context, where
{display_recipient}/{topic}/{display_reply_to} inside <template>
would always show the same stream/topic name regardless of the
actual stream/topic being hovered over.
2023-05-02 13:50:46 -07:00
Sahil Batra e3598c80ec settings: Move setting to allow message content in email notifications.
We move "Allow message content in message notification emails" setting
from "Other settings" subsection to "Automated messages and emails"
subsection.

Fixes #25339.
2023-05-02 13:42:38 -07:00
Sahil Batra 691f3c2d49 settings: Reorder settings in "Automated messages and emails" section.
This commit reorders the settings in "Automated messages and emails"
subsection such that most useful options are at top and automated
messages and email settings are grouped together as proposed
in #25339.
2023-05-02 13:42:38 -07:00
Sahil Batra b2873d312d settings: Move setting elements inside organization-settings-parent div.
This commit moves all the settings in "Automated messages and emails"
subsection inside ".organization-settings-parent" div to make it
consistent with other subsections. This does not affects visual
appearance.
2023-05-02 13:42:38 -07:00
evykassirer 9ea6eca253 compose: Move cursor to end of topic input after stream selection.
Fixes #25321.
2023-05-02 12:49:31 -07:00
Tim Abbott 2afe6fea3a send_later: Fix leaking drafts for scheduled messages.
Previously, if one had started working on a message from a draft, and
then schedules it to be sent later, the draft would not be cleared
when the server accepts the request to schedule the message.
2023-05-02 12:20:30 -07:00
Hardik Dharmani 2aaf098ebc compose: Shorter the separator line between Send and 3-dot buttons.
Added a div inside #send_later button with class separator-line,
height 70%, width 1px and `background-color: hsl(0deg 0% 100% / 65%)`
to make it look like a line also made #send_later a flex with
`align-items: center` so that separator line is vertically centered.
2023-05-02 11:05:45 -07:00
Joelute 4d91df559c unread_banner: Update colors of unread banners.
Previously, the color of the unread banners is yellow which signals more
of a warning to the users. After a discussion in CZO, it was decided to
set setting configured unread banners to blue, which represents more of a
notice/informational banner as the user should be aware of the changes they
made to their settings.
2023-05-02 09:14:28 -07:00
Joelute 5018cec311 unread_banner: Refactor unread banner HTML structure.
Previously, the unread banner templates just rendered on the contents of
the unread banner. This works fine if we don't want to make changes towards
the parent/container of the contents.

This change introduces a new container to each unread banner templates and
a rename. Thus, we can make unique styling changes to the unread banners
while also bring the structure closer to how it is for compose banners.
2023-05-02 09:14:28 -07:00
Aman Agrawal 578ddbc5c8 scheduled_message_banner: Change design.
Convert `View scheduled messages` button into a link and use
default colors for "Undo" button.
2023-05-02 09:10:58 -07:00
Aman Agrawal 9a71a7683f popover_menus: Use correct method to close `send_later_modal`.
Previous method was rightly giving us console warnings.
2023-05-02 09:10:58 -07:00
Aman Agrawal a90862566f scheduled_messages: Pop scheduled_messages from page_params. 2023-05-02 09:10:58 -07:00
Aman Agrawal ce3dcbab71 scheduled_messages: Remove impossible case.
This case handled client receiving an `add` event before
scheduled_messages was initialized.  Since `server_events`
is initialized after scheduled_messages is initialized,
this case was not possible.
2023-05-02 09:10:58 -07:00
Aman Agrawal a6bd4a6565 sever_events_dispatch: Place `scheduled_messages` event alphabetically. 2023-05-02 09:10:58 -07:00
Aman Agrawal 0d3b617a82 send_later_modal: Disable interaction with modal when flatpickr is open.
Fixes #25365
2023-05-02 09:10:58 -07:00
Tim Abbott 1c07756150 scheduled messages: Use data-scheduled-message-id.
This helps make it really clear that these are not message IDs, they
are scheduled message IDs.
2023-05-01 22:45:03 -07:00
Aman Agrawal 12a2e3122f popover_menus: Show last selected time in send later popover. 2023-05-01 22:45:03 -07:00
Aman Agrawal ee354bb007 send_later: Only store timestamp values in `selected_send_later_timestamp`.
This removes any confusion regarding what format of time does
this variable has.
2023-05-01 22:45:03 -07:00
Aman Agrawal 1885ed783a compose: Add new banner for success message scheduled. 2023-05-01 22:45:03 -07:00
Aman Agrawal fe4bfebbdc scheduled_messages_overlay_ui: Show scheduled time in standard format. 2023-05-01 22:45:03 -07:00
Aman Agrawal 7d373c54a9 scheduled_mesages: Use events to update scheduled message data.
This also allows to display scheduled message overlay without
fetching any data.
2023-05-01 22:45:03 -07:00
Aman Agrawal eb5f679121 scheduled_messages_overlay_ui: Use CSS to display no scheduled messages. 2023-05-01 22:45:03 -07:00
Aman Agrawal 1b60019c60 schedule: Remove 'Schedule' state of compose box.
Fixes #25340

This means that we now schedule the message simply after selecting
time if the message is valid.

Also, editing scheduled messages will now delete the scheduled
message and open compose with scheduled message.
2023-05-01 22:45:03 -07:00
Anders Kaseorg 8f2f2654a5 web: Avoid slow jQuery :selected selector.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-01 22:39:31 -07:00
Anders Kaseorg ff2a7b775a web: Avoid slow jQuery :input, :checkbox, :radio selectors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-01 22:39:31 -07:00
Lalit 7aa1763d73 typeahead: Delete display mode slash commands.
This commit deletes `/fixed-width` and `/fluid-width` slash commands
from the typeahead and also hides the slash commands `/light` and
`/dark` in production.

Fixes #25374.
2023-05-01 22:31:04 -07:00
Tim Abbott 7425079814 topic_list: Show muted unread counts in muted streams.
When all the unread messages in a muted stream are in specifically
muted topics, this ensures that the total unread count for the stream
that the user sees before clicking "more topics" will match the total
unreads number for the stream itself.

This behavior is limited to muted streams, since in a normal / not
muted stream, we don't display a "muted topics only" faded unread
count by the stream's summary line to avoid distracting the user with
it, we match that behavior for the "more topics" line.

We also now display the `@` , again to ensure the stream's summary
line never displays an `@` without some topic row having one.
2023-05-01 21:13:53 -07:00
Anders Kaseorg ba170b4aee util: Speed up clean_user_content_links by persisting an inert document.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-01 20:55:01 -07:00
Anders Kaseorg c951b72884 right_sidebar: Fix use of undefined realm_rendered_description.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-05-01 20:55:01 -07:00
N-Shar-ma 1480eca7d5 hotkey: Update deprecation notices to use Shift for capital letters.
To make the deprecation notices consistent with how we format shortcut
keys, we use "Shift +" prefix for capital letters, and write small
letters as capitals.
2023-05-01 20:32:58 -07:00
N-Shar-ma c6ba33b7b4 hotkey: Repurpose `s` to toggle conversation view and remove `shift+s`.
Earlier, the `s` hotkey just narrowed to the stream of the selected
message (to a topic), while `shift+s` narrowed to the conversation view
(topic / dm) of the selected message.

Now, the `shift+s` hotkey has been removed (but retained for toggling
subscription to a stream when the stream overlay is active), and the `s`
hotkey takes on double duty: if the current view is not topic / dm, it
narrows to that, else when in topic view, it switches to stream view. It
has no effect when in dm view. Documentation has been updated for this
both in the help center, and the in-app `Keyboard shortcuts` menu.

A deprecation notice has been added for `shift+s` as well.

Fixes: #24226.
2023-05-01 20:32:58 -07:00
Hardik Dharmani d7114dc291 left_sidebar: Drop underlined behaviour on focus for <a> elements.
Fixes #25359
2023-05-01 20:32:35 -07:00
Tim Abbott 18e2cee572 typeahead: Do not prioritize exact name matches for users.
As discussed in the comment, this resulted in the many inactive users
in chat.zulip.org with "Tim" as their full display name from being
incorrectly prioritized over me in a stream where I've been active;
and this class of problem seems like it will be common in large open
communities.

This reverts a portion of 4dc1b2f812,
with explanatory comments for why this behavior is preferred.

The stream name changes in the original PR remain very helpful.
2023-05-01 17:10:59 -07:00
Tim Abbott 0b7dd46530 stream settings: Improve label for stream edit modal.
"Change stream info" was very ambigious about what types of
information can be changed in the modal in question.
2023-05-01 17:04:17 -07:00
Tim Abbott 2dd1ff7bfd stream settings: Use tippy-zulip-delayed-tooltip more.
This fixes an issue where the "Change stream info" button would
display a tooltip immediately upon closing the modal to edit the
stream name and description.
2023-05-01 17:04:17 -07:00
sbansal1999 323d749189 status-message: Add margin-top to sender info to avoid overlap.
Earlier, the sender info would overlap with the edit compose
area because of another class applying "margin-top" to keep
the sender info properly aligned when the message is not being
edited. However, that "margin-top" had to be changed when the edit
compose is opened.

This commits adds that "margin-top" to sender info to make sure
that it doesn't overlap with the edit compose area.
2023-05-01 16:36:37 -07:00
Aman Agrawal a02f431036 css: Fix date row overlapping with message header.
When there was an unread message below date row, the date
row overlaps with the message header.

This was a result of #23538 not adjusting the message header
z-index along with the z-index of date row.
2023-05-01 10:56:44 -07:00
sbansal1999 aa33ae4af8 ts: Convert resolved_topic.js to TypeScript. 2023-05-01 10:55:36 -07:00
Daniil Fadeev 914ed51d70 compose: Fix buttons in error banners is not clickable. 2023-05-01 10:37:09 -07:00
Steve Howell 663170f0d3 code cleanup: Alphabetize event types in switch statement. 2023-05-01 07:26:51 -07:00
Tim Abbott 6fe02e933a timerender: Extract new variant of get_full_datetime.
Separating these concepts allows us to provide a much nicer format for
contexts where ultra-specific clarification is not a priority.

This new variant is currently only used in the scheduled messages UI.
2023-04-30 22:39:52 -07:00
PALASH BADERIA 341f3a1ce2
tippy: Add message_list_tooltip helper to clear tooltips on rerender.
We've had a series of bugs where tooltips get leaked when a message list
is rerendered. For some tooltips, we used a 'mutation observer' to remove the tooltip
in this situation, but this was expensive and messy. We replace this with a Tippy
plugin to keep track of this class of tooltips, with a central hook to remove them
during rendering.

Message lists are rerendered in the background in a variety of situations;
a simple way to trigger it is clicking the mute/unmute topic/stream button in
the topic menu/stream menu and the clickable area overlaps with the
message list tooltips area. If a tooltip was visible at the time, the tooltip loses its
reference due to the re-rendering removing its DOM element, appearing at the top-left corner.

To prevent this behavior for all message list tooltips, we need to
store all instances of the message list tooltips and then destroy
them if the instances does refer to something else then document.body
using the 'destroy_all_message_list_instances' function just
before re-rendering.

Whenever the message list is rendered, all the message list tooltips
will be destroyed if they do not refer to document.body. This
prevents the double appearance of those tooltips if the reference
is removed from the DOM.

This plugin allows us to remove the mutation observers and net delete code
while hopefully fixing this bug for the whole app.
2023-04-30 22:33:14 -07:00
Tim Abbott 368d2aa27d compose: Fix misaligment of compose top right icons.
When composing a private message to a different recipient than the
current view, the go-to-compose-target icon looked vertically
misaligned with these icons. Fix this by removing the CSS rule that
made these other top-corner icons not centered within their row.
2023-04-30 21:02:21 -07:00
Hardik Dharmani 69779688f0 settings: Update disabled state of button in email change modal.
The new update_submit_disabled_state_on_change feature of the
dialog_widget component makes this simple.

Fixes #22683.
2023-04-30 20:56:51 -07:00
Hardik Dharmani 96d6fda2a7 dialog_widget: Add support for managing submit button disabled state.
The new update_submit_disabled_state_on_change parameter configures
the dialog_widget system to disable/enable the confirmation button
depending on whether any of the fields in the modal have values
differing from their initial values.

Fixes #22683.
2023-04-30 20:56:49 -07:00
sbansal1999 33705b6116 tooltips: Remove keyboard shortcuts from View Scheduled Messages modal.
This commit removes the keyboard shortcut from tooltips that
can be seen when hovering over the two buttons in
"View Scheduled Messages" modal.

This is a temporary change as the keyboard shortcut will be
added to the tooltips when the shortcuts are actually working.
2023-04-30 20:34:53 -07:00
Aman Agrawal eeb3ff26e1 css: Fix loading spinner position for messages loading indicator. 2023-04-29 07:21:19 -07:00
Lalit 3e179a2c58 actions_popover: Hide "Add emoji reaction" in action menu in spectator mode.
We should hide the "Add emoji reaction" from the message action menu while a
user is not logged in, that is user is in public access mode.

Fixes #25331.
2023-04-28 20:09:24 -07:00
palashb01 acba8518fb recent: Replace presence dot with bot icon for bots.
This commit replaces the presence dot with a bot icon for
private messages (PMs) with bots in the recent conversations
narrow.
2023-04-28 19:14:00 -07:00
palashb01 8eb90bbc7f left_sidebar: Fix the opacity of group,bot icons.
This commit fixes the opacity of the group-icon and bot-icon
in the left-sidebar direct message section to make them look
 more consistent with the other icons in the left sidebar.
2023-04-28 19:14:00 -07:00
palashb01 cee0cabd8d left_sidebar: Replace the presence dot with bot icon for bots.
This commit replaces the presence dot display with a bot icon
for bots in the left sidebar PM list.
2023-04-28 19:14:00 -07:00
palashb01 29377c7f32 user_card: Fix the padding of bot-icon with name.
This commit fixes the padding of the bot-icon with the name
to make it look consistent with the way it is displayed in
the message feed.
2023-04-28 19:14:00 -07:00
palashb01 bb4d2f5f5b profile_popover: Remove the display presence dot for bots.
This commit removes the presence dot display for bots and fixes
the gap between the bot name and bot icon in the user profile
popover. It also fixes the alignment of the bot icon.

Fixes: #25066
2023-04-28 19:14:00 -07:00
evykassirer 199afbe8eb messagebox: Update background-color for mentions.
This is part of #22059.
2023-04-28 19:06:50 -07:00
Tim Abbott 56c5c8902b scheduled_messages: Disallow dates in the past in the UI.
The server will probably accept them and just send the message
immediately, which seems OK, but we probably want to discourage
scheduling a message to be sent in the past, since that's unlikely to
be intentional and would make it hard to undo.
2023-04-28 19:01:40 -07:00
Tim Abbott cef1e3363c compose: Increase size of recipient menu.
We should do a better long-term fix, but the current menu feels cramped.
2023-04-28 18:44:11 -07:00
Tim Abbott 798391824b compose: Refactor dropdown-menu CSS rules. 2023-04-28 18:43:51 -07:00
Karl Stolley e4ae4c5b75 send_later: Remove send_later_input_group.
This removes the HTML structure and CSS styles previously associated
with the element in the scheduling modal.

Preserving this all in its own commit in case it needs to be
restored.
2023-04-28 17:50:54 -07:00
Karl Stolley 8180cc786f send_later: Pick time from 'Custom time' link.
This introduces a 'Custom time' link to the bottom of the scheduling
modal's options. Clicking on it pulls up the date picker.

Additionally, clicking on the 'Custom time' link, then clicking
elsewhere to close the time-picker, then subsequently clicking
'Custom time' again reveals the time-picker.

However, repeatedly clicking the 'Custom time' link while the
date-picker is already open will cause the date-picker to redraw
each time.
2023-04-28 17:50:54 -07:00
Karl Stolley 865cba834b send_later: Cancel scheduling from popover. 2023-04-28 17:50:54 -07:00
Aman Agrawal e89cbf0ac1 send_later: Move some options to a modal. 2023-04-28 17:50:54 -07:00
Tim Abbott 13592b4495 scheduled_messages: Fix date formatting call.
d42ac60d61 accidentally lost the "new Date" part.
2023-04-28 17:50:54 -07:00
Tim Abbott d42ac60d61 scheduled_message: Fix i18n for scheduled time. 2023-04-28 17:25:00 -07:00
Aman Agrawal f40855bad2 reminder: Remove feature from zulip.
This is being removed to make the code simpler. We have plans
to add it as a feature in the future , but it will most likely
not use the same code.
2023-04-28 17:25:00 -07:00
Aman Agrawal 6bff396711 scheduled_messages: Remove unnecessary compose_fade call.
We just need to call clear_compose_box() here similar to when
sending a message.
2023-04-28 17:25:00 -07:00
Aman Agrawal 5baa0dc313 compose: Use the new endpoint to create scheduled messages. 2023-04-28 17:25:00 -07:00
Lauryn Menard 7739703111 scheduled-messages: Update scheduled message objects in the API for type.
Updates the objects in the API for scheduled messages so that those
for stream messages return the `to` property as an integer since it
is always the unique stream ID and so that those for direct messages
do not have a `topic` property since direct messages never have a
topic.

Also makes small update so that web app scheduled messages overlay
has the correct stream ID.
2023-04-28 17:25:00 -07:00
Aman Agrawal 963fe566d7 scheduled_messages: Use scheduled_message_id instead of message_id.
Using `message_id` can be confusing for API users since it can be
mistaken for the ID of the message that will be sent.
2023-04-28 17:25:00 -07:00
Hardik Dharmani a2b36bbabb user_card: Fix user_card background for dark theme for width < $md_min.
Previously, in the dark theme, the `background-color: #18222f` of the
`.popover` class took precedence over the
`background-color: hsla(0,0%,0%,.7)` of the `.message-info-popover`
and `.user-info-popover` classes. This commit fixes this issue by
adding !important to the background-color property of
`.message-info-popover, .user-info-popover` classes.
2023-04-28 15:35:43 -07:00
Hardik Dharmani d43c5e6071 tooltips: Convert edit notice tooltips to tippy. 2023-04-28 15:34:59 -07:00
Hardik Dharmani 15860c8b13 tooltips: Convert recipient row tooltips to tippy. 2023-04-28 15:34:59 -07:00
Aman Agrawal b33438eb55 css: Move `10px` navbar bottom padding above message header.
This is a more natural place for this extra padding than below the
navbar. Padding below navbar was primarily needed to hide the
message content above the sticky header while scrolling the message feed.
We are still able to do with this change without partially hiding the
loading message indicator.

Fixes #25159
2023-04-28 12:48:10 -07:00
Lalit 0d51e2d1f9 left_sidebar: Add same styles to schedule messages row as all other rows.
This fixes the bug where the schedule message whole row was not clickable
and had some padding issues. By adding same styles as all other rows in
left sidebar we eliminate those bugs.
2023-04-28 12:44:59 -07:00
Karl Stolley df508659db css: Lighten button border for visibility.
This replaces the previous dark border.

A pure white border looked a little too garish, so this dials back the
alpha channel just a bit.

Fixes: #25303.
2023-04-28 12:44:30 -07:00
Karl Stolley 942eb7b375 css: Pad send button for click comfort. 2023-04-28 12:44:30 -07:00
Karl Stolley d9654f4f0a css: Introduce padded vdots for send later.
This uses eyeballed vertical padding on the nested .zulip-icon class
to ensure that the entire send-later button area is clickable (and
not merely hoverable).
2023-04-28 12:44:30 -07:00
Aman Agrawal 2deec692f6 dark_theme: Fix dark recipient background in light theme for spectators.
Since, we didn't update `user_settings.color_scheme` for spectators
and our recipient bar color calculations were based on it, this
resulted in a wrong recipient bar color if the OS default color
scheme of the user was different from `spectator-theme-preference`
set by the user using the gear menu.

To reproduce the bug:
* Set preferred color scheme to `dark` in your OS settings / Chrome
  dev tools.
* Login as spectator in Incognito.
* Switch to light theme.

You will see dark background colors in recipient bars.
2023-04-28 12:39:46 -07:00
Lauryn Menard f574bd4952 narrow: Fix "pm-with" narrow in scheduled messages. 2023-04-28 12:38:29 -07:00
Tim Abbott 496b403fcf tooltips: Add new central tooltip template store.
We should migrate all the static content tooltip templates to this
file to avoid duplicate DOM elements.
2023-04-27 18:12:32 -07:00
Hardik Dharmani ea6ae50326 tooltips: Add tippy tooltip for view_user_card.
Added modern tippy tootip for view_user_card tooltip by adding a
<template> with id=view-user-card-tooltip-template for the element.

Fixes part of #24311.
2023-04-27 18:12:32 -07:00
Tim Abbott 6aea3f2be5 tooltips: Use tippy tooltip for stream list toggle. 2023-04-27 18:12:32 -07:00
Hardik Dharmani dcfd374f2f left_sidebar: Correct hotkey for `All direct messages` tooltip. 2023-04-27 18:12:32 -07:00
Hardik Dharmani 941c15b802 tooltips: Add tippy tooltip for search_query.
Added tippy tooltips for search_open, search_close icon and
search_query input field with hotkey hint `/' by adding a class
`.tippy-zulip-delayed-tooltip` which adds tooltip with
LONG_HOVER_DELAY and default placement top with fallback placement
equal to bottom.

Added tippy tooltip with text `Close` on `.search_close_button`.

Fixes part of #24311
2023-04-27 18:12:32 -07:00
Hardik Dharmani 9c866f9be1 tooltips: Add tippy tooltip for message expander/condenser.
Added tippy tootip for '.message_expander' and
'.messsage_condenser' by adding '.tippy-zulip-delayed-tooltip' class,
and creating 2 <template> with id equal to crresponding
data-tooltip-template-id of the elements.

Fixes part of #24311
2023-04-27 18:12:32 -07:00
Hardik Dharmani 15a15240da tooltips: Add tippy tooltips in manage stream settings.
Added tippy tooltips for create_stream_plus_button and
preview-stream-button in manage stream settings by adding
class `.tippy-zulip-delayed-tooltip` which add tooltips
with LONG_HOVER_DELAY. Added data-tippy-placement="bottom"
to match with 'Archive stream' tooltip.

Created a new tooltip for sub_unsub_button in tippyjs with
class .toggle-subscription-tooltip that has
EXTRA_LONG_HOVER_DELAY, placement equals to bottom
and appended to body.

Fixes part of #24311.
2023-04-27 18:12:32 -07:00
Hardik Dharmani 394fcbfd51 tooltips: Add tippy tooltip for userlist-toggle icon with hotkey hint `W`. 2023-04-27 18:12:32 -07:00
Hardik Dharmani 892bd38062 tooltips: Use tippy for `gear-menu` icon with hotkey hint `G`.
Fixes part of #24311
2023-04-27 18:12:32 -07:00
Hardik Dharmani 7785fb2948 tooltips: Add new tippy configuration `.tippy-zulip-delayed-tooltip`.
Added new tippy tooltips configuration with target class
`.tippy-zulip-delayed-tooltip` which add tooltips with
`delay: LONG_HOVER_DELAY`, appended to body, and have a
default placement top with fallback placement equal to bottom.

Fixes part of #24311
2023-04-27 18:12:32 -07:00
Palash Baderia c10d33d23c tippy: Remove the focus trigger from the compose-control-buttons.
By default, tippyjs uses a trigger value of 'mouseenter focus',
which means that the tooltips can appear either when the element
is hovered over or when it receives focus (e.g., by being clicked).
Because of this, if you click on the button to open the popover,
the tooltip also appears. To prevent this behavior, we need to
remove the 'focus' trigger from the buttons so that the tooltips
don't appear when the buttons are clicked.

Fixes: #25277
2023-04-27 17:36:48 -07:00
evykassirer 19d5fedfd2 compose: Move functions around to reduce circular imports. 2023-04-27 17:04:19 -07:00
evykassirer 0e13134be2 stream header colorblock: Remove unnecessary `find`. 2023-04-27 17:04:19 -07:00
evykassirer f9bf688c9e compose: Add DM icon to the recipient dropdown.
This commit adds the new users icon and uses it in the
recipient dropdown, both in the selection options and
the selected option displayed on the button.
2023-04-27 17:04:19 -07:00
evykassirer 408bdc2273 compose recipient: Move DM to bottom of dropdown when feature is disabled. 2023-04-27 17:04:19 -07:00
evykassirer 18312be6db compose: Add ability to switch to PM in stream dropdown.
Fixes #3409
2023-04-27 17:04:19 -07:00
evykassirer e4fc197871 click handlers: Don't move focus for clicks in compose box while composing.
If a click happens somewhere within compose, we don't want to cancel compose
and we also don't necessarily want to refocus the cursor in the compose
text area.

This change was made because clicks in the compose recipient dropdown
were hitting the first `if` statement and moving focus to the text area
when it should have gone to the topic or PM recipient input fields.
This `if` block was originally written for clicking external links and
codeblocks, which are outside of the #compose div and won't be affected
by this change.
2023-04-27 17:04:19 -07:00
evykassirer 0634457731 compose: Deduplicate code for fetching recipient switcher options. 2023-04-27 17:04:19 -07:00
evykassirer 6c797904f2 compose: Let recipient switcher change width with content. 2023-04-27 17:04:19 -07:00
evykassirer 695946746e compose: Rename stream selection widget to "select_recipient".
Previously this dropdown was only for selecting streams, but
soon it will also be for switching to a private message. This
name helps it be clearer that the dropdown is more general
purpose.
2023-04-27 17:04:19 -07:00
N-Shar-ma 4dc1b2f812 typeahead: Always show exact matches first for streams and users.
We refactor the triage function to optionally take in a comparator
function, and use this to sort the results, except any exact match,
which is placed highest. Now we don't need to sort the results of triage
for streams, languages and slash commands since we just pass in the
comparator function. The overall effect is same as before, except that
exact matches are always shown first.

For users, we can't use the new triage feature to achieve this goal
without sorting `rest` and breaking a key optimization, so we just add
a bit of manual code for the job.

Fixes: #25123.
2023-04-27 12:45:26 -07:00
Sahil Batra 7eacd525b4 compose: Show banner if user is not allowed to post in the stream.
We now show a banner on opening the compose box and changing the
stream in dropdown, if a user is not allowed to post in a stream.

The "Send" button is also disabled if user is not allowed to post
in the stream.

This commit also moved the CSS for disabled modal button in dark
theme below after the other CSS for modals as we are using the
same CSS for the "Send" button as well in disabled state.
2023-04-27 12:31:40 -07:00
Sahil Batra e02111e458 compose: Show all accessible streams in stream dropdown menu.
We now show all the streams, even if user is not allowed to post
in them, in the stream dropdown in compose box. In further commits,
we would add a banner mentioning that user is not allowed to post
for such streams.
2023-04-27 12:31:40 -07:00