Commit Graph

186 Commits

Author SHA1 Message Date
Aman Agrawal a78dc4a2bd css: Scroll on `html` instead of `.app`. 2023-05-24 15:43:19 -07:00
Daniil Fadeev 3e2d5b3c86 compose_validate: Use correct stream_id value for different context.
This commit addresses the issue of relying on `compose_state` for
retrieving the `stream_id` to display warning banners. Previously,
warnings were shown for syntax in the message edit box based on
whether that syntax would trigger a warning for the draft content (if
any) currently in the compose box.

We fix this by using a new `get_stream_id_for_textarea` function to
obtain the correct `stream_id` value for the check being done.

Fixes: #25410.
2023-05-24 12:48:44 -07:00
sbansal1999 7c68a30363 billing-helpers: Add commas to formatted amount. 2023-05-24 11:32:24 -07:00
Hardik Dharmani d9716bc189 left_sidebar: Improve mentions in muted topics.
When there are only muted unread mentions in a stream, show `@` icon
and unread count in faded style, also align the `@` on more topics
with no unead counter on it.

If there are only muted unread messages without mentions don't show
the unread counter on the stream.

Fixes #25382.
2023-05-19 18:40:57 -07:00
Lalit 7ac891a6b9 people: Add `version` parameter for medium sized avatar urls.
We need to append the `version` parameter when constructing the urls for
medium-sized images so that the browser updates the image in real time when
the user uploads a new avatar.

Fixes #25558.
2023-05-19 13:52:00 -07:00
Akarsh Jain 12db83b011 help: Open Help Center links in new tab for empty message lists.
This commit updates the Help Center links in all relevant empty message
list views to open in a new tab by default. This prevents users from being
navigated away from the app.

Fixes #25337.
2023-05-19 13:51:00 -07:00
Lalit 656a31d38d refactor: Move `maybe_get_stream_name` from `stream_data` to `sub_store`.
This commit moves `maybe_get_stream_name` function from `stream_data` to `sub_store`
as it didn't had any dependency on `stream_data` and it also helps us to cut off
dependency on `stream_data` for some of the modules including `user_topics`.
2023-05-18 08:46:16 -07:00
Karl Stolley 386d87635e popovers: Shorten 'Quote or reply' label.
This removes the previous "or forward" text from the message
actions popover, and keeps the documentation in sync with the
new text. Internationalization tests are updated, too.

Fixes #25603.
2023-05-16 12:36:29 -07:00
Aman Agrawal c96de330b0 stream_color: Dim recipient bar background color. 2023-05-16 12:35:17 -07:00
Brijmohan Siyag cb00fbc42f compose: Check posting policy for direct messages.
Prior this commit, changing the message type from a stream (where posting
was not allowed) to a direct message using the compose box dropdown, did not
changed the state of the send button from disabled to enabled even though
direct messages were allowed in the organization.

This was happening because `check_stream_posting_policy_for_compose_box` was
only for streams.

Now, function is updated to check for both streams and direct
messages, as it checks if direct messages are allowed or not, and depending on
that, it updates the send button's state, tooltip and displays a relevant banner.
2023-05-16 11:24:35 -07:00
Tim Abbott 3876171df1 compose: Fix opening compose box when viewing invalid stream.
This likely needs further refactoring to switch to using stream IDs
rather than names in this code path, but this change fixes an
exception that would be throw when opening the compose box while
viewing a narrow to an invalid stream name/ID.
2023-05-16 10:39:33 -07:00
Daniil Fadeev cb69413301 send_later: Add keyboard navigation to message scheduling modal.
Fixes: #25404.
2023-05-15 14:52:06 -07:00
Daniil Fadeev e64e5f2413 scheduled_messages: Add keyboard navigation.
Keyboard navigation has been added to the scheduled messages modal
in this commit. The solution is based on the `modals_handle_events`
function from the `messages_overlay_ui.js` module, as well as some
helpful functions from the same module.

Fixes: #25181.
2023-05-15 14:46:21 -07:00
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
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
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
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
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
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
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 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
Aman Agrawal 8ea59f7f02 compose: Use tippy for stream select dropdown.
Fixes #25434
2023-05-09 14:11:26 -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 5d97dbf8b3 zblueslip: Show chained causes in unexpected messages. 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 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
Tim Abbott 9e5c1eff4b scheduled messages: Fix incorrect mapping of 4PM to 16:00 hours. 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
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
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 0756ac9250 channel: Refactor xhr_error_message to accept message optionally. 2023-05-05 13:43:08 -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
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 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
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
evykassirer 9ea6eca253 compose: Move cursor to end of topic input after stream selection.
Fixes #25321.
2023-05-02 12:49:31 -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 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
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
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