Commit Graph

2858 Commits

Author SHA1 Message Date
Anders Kaseorg b897be76b4 message_edit_history: Replace date-fns format with Intl.DateTimeFormat.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-19 15:21:34 -08:00
Anders Kaseorg 64a7810065 timerender: Replace date-fns format with Intl.DateTimeFormat.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-19 15:21:34 -08:00
Anders Kaseorg 581092a964 timerender: Respect the user’s language setting in get_tz_with_UTC_offset.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-19 15:21:34 -08:00
Anders Kaseorg 100f91e1c9 timerender: Remove unnecessary get_user_locale function.
Subscripting an empty array does not throw an exception in JavaScript,
"default" is not a valid locale, and the browser APIs already fall
back on unrecognized locales anyway.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-19 15:21:34 -08:00
Prakhar Pratyush c539b8ee46 watchdog: Handle exception in `callback`.
Earlier, in the 'check_for_unsuspend' function, we didn't
handle the exception, if any, during callback execution,
resulting in 'watchdog_time' not always being updated.

This commit handles the exception using the try/catch block.

Fixes #27723.
2023-11-19 15:04:58 -08:00
Karl Stolley 295b4fc337 message_feed: Size visibility policy icons the same as others. 2023-11-18 05:35:06 -08:00
Karl Stolley 3e4f7108a0 message_feed: Vertically align link icon in recipient bar. 2023-11-18 05:35:06 -08:00
retsambew 9a0a7c1779 message_view_header: Add tooltip to stream name in top navbar.
At present, it's not obvious that clicking on the stream name in the
top navbar will take the user to stream settings. To make it more
apparent, we add a tooltip to the stream name, explicitly indicating its
functionality.

We also add a second line to the tooltip thar displays the number of
subscribers to the stream and remove the tooltip from the number of
subscribers indicator on the top navbar. These changes are in preparation
for removing the number of subscribers indicator from the top navbar.

Fixes #27360.

Co-authored-by: Sayam Samal <samal.sayam@gmail.com>
2023-11-17 17:55:51 -08:00
Karl Stolley 4740a58318 top_navbar: Match navbar icons to left sidebar navigation. 2023-11-17 17:28:54 -08:00
Karl Stolley fa8504fffb top_navbar: Space navbar title with padding only. 2023-11-17 17:28:54 -08:00
Karl Stolley cabbff73fd top_navbar: Properly align icons horizontally and vertically.
This adds 3px of margin where previously whitespace separated the
icon from the title.
2023-11-17 17:28:54 -08:00
Karl Stolley 6d452dbe6e top_navbar: Extend new flex-based styles to navbar titles. 2023-11-17 17:28:54 -08:00
Karl Stolley 6271f4d6ba top_navbar: Use flexbox to align icon, stream name, and description. 2023-11-17 17:28:54 -08:00
Karl Stolley 000299a323 top_navbar: Consolidate selectors, replicate styles. 2023-11-17 17:28:54 -08:00
Karl Stolley 1337b60738 top_navbar: Remove unecessary styles and vertical padding. 2023-11-17 17:28:54 -08:00
Karl Stolley 74018c16be top_navbar: Structure navbar titles with a span.
Having an actual DOM node, instead of a text node, will make flex
boxes and other layout mechanisms work more reliably.
2023-11-17 17:28:54 -08:00
aryan d707f10bb2 message_view_header: Remove subscribers count from the top bar.
Removed the sub_count element along with its styles and dependent
functions.

Fixes #27361.
2023-11-17 17:28:54 -08:00
Prakhar Pratyush cc934429fe settings: Add option for followed topics to unread count badge setting.
This commit adds a new option 'DMs, mentions, and followed topics'
to 'desktop_icon_count_display' setting.

The total unread count of DMs, mentions, and followed topics appears
in desktop sidebar and browser tab when this option is configured.

Some existing options are relabeled and renumbered. We finally have:
* All unread messages
* DMs, mentions, and followed topics
* DMs and mentions
* None

Fixes #27503.
2023-11-17 14:07:20 -08:00
Vector73 95fdf82a53 style: Fix overflow of text.
Fixes: #27282
2023-11-17 10:33:42 -08:00
N-Shar-ma cec11be7c1 compose: Disable send button when upload/s are in progress.
Earlier, the send button's state was determined independently by the
message length and the upload status, and its containing `div`'s state
was separately determined on recipient change by whether the user had
permission to post in that stream, or if direct messages were allowed
in the organisation. The main problem was that as the message length
check was run on each character input, it often overrode the upload
status check.

Now for consistency, the code has been refactored to always disable the
send button by accordingly styling its containing `div`; and using the
observer pattern we update it anytime the message length, upload status,
or the recipient changes, considering **all** of them together.

(The Save button when editing a message still works like before -- only
dependent on upload status.)

Fixes: #21135.
2023-11-17 10:31:58 -08:00
N-Shar-ma 6bc9092786 compose: Fix bug where extra line breaks were pasted between blocks.
Due to the way turndown pads every block element with 2 new lines, and
makes `br` double space by default, we would get 3 blank lines pasted
when there's just 1 line break between 2 paragraphs.

Now we set `br` to an empty string, and since turndown collapses
sequences of multiple new lines to `\n\n` (1 blank line), so any 2 block
elements will now always have 1 blank line between them, irrespective of
if and how many line breaks there are between them in the copied HTML.
2023-11-17 08:55:55 -08:00
David 81f99dde55
gear_menu: Rename "Manage streams" -> "Stream settings".
Fixes #27754.
2023-11-17 08:53:41 -08:00
Anders Kaseorg 1dd386a65a tippyjs: Convert module to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-16 17:26:54 -08:00
Anders Kaseorg a8bc7ceb15 tippyjs: Remove wrong $ prefix for non-jQuery variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-16 17:26:54 -08:00
Tim Abbott 3cfe4b720c Revert "linkifiers: Match JS implementation to server implementation."
This reverts commit 091e2f177b.

This version of python_to_js_linkifier fails for at least some real
linkifiers. We'll likely re-introduce this after a bit more debugging.
2023-11-16 14:59:48 -08:00
Sahil Batra 3c8701ee36 streams: Add API endpoint to get stream email.
This commit adds new API endpoint to get stream email which is
used by the web-app as well to get the email when a user tries
to open the stream email modal.

The stream email is returned only to the users who have access
to it. Specifically for private streams only subscribed users
have access to its email. And for public streams, all non-guest
users and only subscribed guests have access to its email.
All users can access email of web-public streams.
2023-11-16 13:25:33 -05:00
Sahil Batra 432001656e streams: Remove "email_address" field from Subscription objects.
This commit removes "email_address" field from Subscription objects
and we would instead a new endpoint in next commit to get email
address for stream with proper access check.

This change also fixes the bug where we would include email address
for the unsubscribed private stream as well when user did not have
permission to send message to the stream, and having email allowed
the unsubscribed user to send message to the stream.

Note that the unsubscribed user can still send message to the stream
if the user had noted down the email before being unsubscribed
and the stream token is not changed after unsubscribing the user.
2023-11-16 13:25:33 -05:00
Tim Abbott e6102af351 Revert "lightbox_view: Fix media title update on change in title."
This reverts commit 273081d0a6.

This change broken the arrow key navigation in the lightbox.
2023-11-16 10:19:05 -08:00
Karl Stolley b04dd62f8a left_sidebar: Preserve DM layout when zoomed into more conversations. 2023-11-16 09:21:48 -08:00
Tim Abbott 7a6f288fab narrow: Move maybe_scroll_to_selected call.
This should now happen at the same time it did prior to this change,
without requiring the show_all_message_view wrapper to have any
business logic.

This fixes a potential scroll position bug in the event that
narrow.deactivate in fact calls itself recursively after a timeout.
2023-11-15 17:33:21 -08:00
Tim Abbott eabab840e9 narrow: Hide inbox/recent views inside deactivate.
We already do a very parallel construction in narrow.activate, so this
moves us towards being able to unify those code paths, while also just
being more readable by avoiding a small-but-important wrapper function
in hashchange.js.

I believe this fixes a bug where we were not saving scroll position in
browser history when navigating to "All messages" from another view.
2023-11-15 17:33:21 -08:00
Tim Abbott d505a3c8b7 hashchange: Fix duplicate hides of inbox/recent views.
Since at least 6ef0753a51, it's been the
case that narrow.activate already hides the inbox/recent views if
open, and the same is true for all messages.

Fixing the duplicate call is important in show_home_view, because
show_all_message_view relies on having an accurate value for whether the
recent/inbox views were already open in order to correctly update the
left sidebar.
2023-11-15 17:33:21 -08:00
Tim Abbott a3842584dd hashchange: Fix flicker when navigating to all messages.
Testing experimentally, removing the setTimeout seems to fix a visible
flicker when using Esc to navigate to "All messages" from the Inbox
view. That setTimeout has been moved around without real examination
since 5d79bb6a20 from early 2013; I
don't see any good reason why it would make be necessary only in the
"All messages" code path, and not when narrowing to any other view.
2023-11-15 17:33:21 -08:00
Karl Stolley 62f5806f42 left_sidebar: Ensure All messages highlight on reload.
Co-Authored-By: Tim Abbott <tabbott@zulip.com>
2023-11-15 17:33:21 -08:00
Tim Abbott 0f01eae655 narrow: Simplify actively_scrolling data flow.
There's no good reason to have the caller of deactivate pass this
parameter in.

This effectively reverts a18b1662cb,
which did this as part of trying to avoid an import cycle, with a more
appropriate solution using the existing message_scroll_state module.

Importantly, it also means that we again wait for scrolls longer than
50ms to finish before opening All messages; I think this might fix a
regression.
2023-11-15 17:33:21 -08:00
Tim Abbott 03f3e17a40 narrow: Clarify first parameter to deactivate.
This previous parameter name was inaccurate, since that's not what the
caller is actually asserting for us.
2023-11-15 17:33:21 -08:00
Karl Stolley f17e4e7198 left_sidebar: Group view-highlight code together. 2023-11-15 17:33:21 -08:00
Anders Kaseorg 2fc327b775 compose_ui: Fall back to comma join when Intl.ListFormat is missing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-15 15:51:33 -08:00
Karl Stolley dd938911f7 compose_box: Set auto height on textarea in full screen. 2023-11-15 15:23:48 -08:00
Karl Stolley 4493ee346d reactions: Set more explicit reaction-text setting. 2023-11-15 14:02:45 -06:00
Karl Stolley b374b21171 reactions: Set interactive hover delay on reaction Tippies.
This introduces a new INTERACTIVE_HOVER_DELAY of 425 milliseconds.
It's meant to be short enough that the tooltip's contents are
displayed without too much of a lag, but long enough that a quick
interaction--like +1'ing an existing emoji--happens without the
quick flash of the tooltip itself.
2023-11-15 14:02:45 -06:00
Karl Stolley 6fe49f93ad reactions: Redesign reaction button colors and style.
See CZO discussion:
https://chat.zulip.org/#narrow/stream/9-issues/topic/Reactions.20background.20color/near/1632171

Also:
https://github.com/zulip/zulip/pull/26580#issuecomment-1705734770

Co-Authored-By: Vlad Korobov <terpimost@gmail.com>
2023-11-15 14:02:45 -06:00
Karl Stolley ff9c931366 reactions: Nuke overwrought inherit declaration.
This is made unnecessary thanks to CSS variables.
2023-11-15 14:02:45 -06:00
Karl Stolley 534683a3ff reactions: Express reaction button colors as CSS vars. 2023-11-15 14:02:45 -06:00
Karl Stolley 474dcf60a2 reactions: Unify stream and DM colors, express as CSS vars. 2023-11-15 14:02:45 -06:00
Karl Stolley a929220d3c message_edit: Add styles for Save and Cancel buttons. 2023-11-15 10:41:51 -08:00
Karl Stolley 8bc12a4ee2 modal_buttons: Make exit button colors in to CSS variables. 2023-11-15 10:41:51 -08:00
Karl Stolley f1a79085eb message_edit: Build basic multi-line layout for message editing. 2023-11-15 10:41:51 -08:00
Karl Stolley 6890c9d171 left_sidebar: Place unread count right of All DMs icon.
Also set a CSS variable for header-icon widths in the left sidebar.

Fixes: #27559
2023-11-15 10:07:04 -08:00
Karl Stolley 614abd58be left_sidebar: Place unread count right of stream controls.
Fixes: #27380
2023-11-15 10:07:04 -08:00
Karl Stolley 335790dae8 left_sidebar: Add unread streams count to Streams header. 2023-11-15 10:07:04 -08:00
Karl Stolley 5accf36115 recent_view: Correct icon alignment within rows. 2023-11-15 09:05:47 -08:00
Karl Stolley 17e87c9a20 compose_box: Fix regression on full-screen Preview areas. 2023-11-15 09:04:54 -08:00
Karl Stolley c5b7432cf2 compose_box: Maintain top alignment in Preview mode. 2023-11-15 09:04:54 -08:00
N-Shar-ma bdba280c3d typeahead: Include wildcard mentions in typeahead for small streams.
We refactor the code checking if wildcard mentions are allowed by
renaming the pre-existing function `wildcard_mention_allowed` to
`wildcard_mention_allowed_in_large_stream`, adding a new function
`is_recipient_large_stream`, then redefining `wildcard_mention_allowed`
to combine these two functions.

Fixes: #27248.
2023-11-15 09:02:34 -08:00
Aman Agrawal 27ffcc6576 bililng: Fix incorrect price per license on billing page.
There is a discrepancy between price per license shown on billing
and upgrade page for annual billing frequency due to difference
in methods used to calculate the amount.

To fix it, we use the same method on both the pages.

I didn't use the helpers.format_money directly here since that would
create a visual delay in showing the price per license which will
not be nice considering that will be the only thing on this page
being updated that way.

The stripe fixture used is same as
free_trial_upgrade_by_card--Customer.retrieve.3.json
2023-11-15 15:59:26 +05:30
Alex Vandiver 091e2f177b linkifiers: Match JS implementation to server implementation.
Since the server-side implementation no longer uses look-ahead
or (more importantly) look-behind, it is possible to exactly implement
in Javascript.  This removes a common class which would prevent local
echo.

This requires reworking the topic linking algorithm, to march the
server's as well.  The tests and behaviour are adjusted in so doing --
previously, the JS implementation would have linked `#foo` with a
`foo` regex on the linkifier, but the server implementation would not
have.
2023-11-14 20:43:39 -08:00
Karl Stolley b2c2afe374 left_sidebar: Keep all DM container rows to same right margin. 2023-11-14 16:43:28 -08:00
N-Shar-ma 76a8c80b63 compose: Pass in stream_id to compose when editing scheduled message.
Earlier, we only passed in the stream name which isn't considered in
`compose_actions.start` when populating the recipient.

There was no visible bug since we first narrow to the correct stream and
then call `compose_actions.start`, but this was brittle since it would
not work if we open the compose box before narrowing.
2023-11-14 16:36:50 -08:00
Sayam Samal 06600028a5 send_later_popover: Use `.navigate-link-on-enter` for scheduled msgs.
We need to use the `navigate-link-on-enter` class for the scheduled
messages link in the popover, since it's a popover menu item with a
`href` attribute. The reason for using this class has been documented
in 246c1d7b4e.
2023-11-14 16:33:44 -08:00
Sayam Samal 0a487e4f92 popovers: Focus first option in send later popover when opened with kbd.
While opening the send later popover via the keyboard, we want to focus
the first text option, which is "Schedule message" at present. When the
popover is opened via mouse click, we want to keep the original behavior
of not focusing on any option.

Note: This is similar to the behavior of the message actions popover,
and hence this commit follows a similar pattern to add the focus.

Fixes: #27701.
2023-11-14 16:33:44 -08:00
Karl Stolley 6f8cac8077 compose_box: Better align and maintain alignment of topic marker. 2023-11-14 13:14:40 -08:00
Aman Agrawal d45a2bf35b stream_color: Increase contrast of stream icon color and background. 2023-11-14 12:23:10 -08:00
Aman Agrawal bbd49d4634 stream_color: Extract function to get corrected color. 2023-11-14 12:23:10 -08:00
kraktus 3de6ec0a59 sort_emojis: Prioritize perfect matches above all.
Currently we prioritize (even partial) realm emojis above all.
Including over perfect matches if the emoji is **not** a realm emoji.
The commit changes this behavior to prioritize perfect matches above all,
regardless of emoji category.

close https://github.com/zulip/zulip/issues/27545
2023-11-14 12:13:22 -08:00
Karl Stolley 5797381ea2 compose_box: Suppress send-area tooltips when vdots popover is open. 2023-11-14 12:10:38 -08:00
Karl Stolley fd8711023d compose_box: Move send-control-button Tippy logic to compose file. 2023-11-14 12:10:38 -08:00
Karl Stolley e82c875bc3 compose_box: Remove unreachable enter_sends cruft. 2023-11-14 12:10:38 -08:00
Prakhar Pratyush c76b3acce7 typeahead: Fix '@topic' not present when stream wildcard suggested.
Earlier, we suggested only the first matching wildcard mention,
irrespective of how many equivalent wildcard mentions match.

That logic leads to the exclusion of '@topic' suggestion whenever
a stream wildcard is suggested, which is not correct as
stream wildcards and topic wildcard are not equivalent.

This commit updates the logic to make the behavior of suggesting
only the first match valid for stream wildcard mentions only.
2023-11-14 12:09:16 -08:00
N-Shar-ma e18c180414 reload: Fix bug where stream input is unexpectedly cleared on reload.
Earlier, we preserved the stream name across reloads, and to restore the
compose state, passed that to `compose_actions.start`, which since
c3fe96a, considers the stream id, and not its name.

This caused a bug where on server initiated reload, the stream input
would not retain its value and be unexpectedly cleared.

This is fixed by preserving the stream id across reloads, instead of its
name, and passing that to `compose_actions.start` instead.
2023-11-14 12:05:14 -08:00
N-Shar-ma 4e35c78fd5 left-sidebar: Fix "New topic" button in stream popover.
Now we pass in the stream's id to `compose_actions.start()` (not its
name), so that the compose box opens with the correct stream selected.
2023-11-14 11:29:54 -08:00
Karl Stolley 994e29e1fc compose_box: Hide send icon when load spinner is showing. 2023-11-14 09:21:11 -08:00
Karl Stolley 0c95772f4e compose_box: Maximize clickable area on send-later vdots. 2023-11-14 09:21:11 -08:00
Karl Stolley 3201c7dfb5 compose_box: Extend use of send-control-button.
This uses `.send-control-button` to handle Tippies on those
elements (currently vdots and Drafts), and removes a confusing
compose-formatting class.
2023-11-14 09:21:11 -08:00
Karl Stolley 5bedbb14b4 compose_box: Rename message-control-button to send-control-button. 2023-11-14 09:21:11 -08:00
Karl Stolley 41b61cfb3e compose_box: Don't fill Topic line on restored draft. 2023-11-13 12:45:13 -08:00
Karl Stolley 93d6bcef0e compose_box: Properly present Drafts button in all languages. 2023-11-13 12:45:13 -08:00
Karl Stolley be34c4c2ef compose_box: Improve Drafts and button alignment in smaller views. 2023-11-13 12:45:13 -08:00
Karl Stolley 71468492b7 compose_box: Restore purple color to Send button. 2023-11-13 12:45:13 -08:00
Karl Stolley d92a1e7ca8 compose_box: Update vdots tooltip to 'Send options'. 2023-11-13 12:45:13 -08:00
Karl Stolley 4fe9e4e715 compose_box: Handle delay, radio selection on Enter-sends elements. 2023-11-13 12:45:13 -08:00
Karl Stolley 7209476b18 compose_box: Integrate Drafts, Enter-to-send in send-later popover. 2023-11-13 12:45:13 -08:00
Karl Stolley 4fee51fc99 compose_box: Render limit indicator as template with zero-width space. 2023-11-13 12:45:13 -08:00
Karl Stolley 601faf8548 compose_box: Handle responsive layouts on send column.
Fixes #27576.
2023-11-13 12:45:13 -08:00
Karl Stolley a6b3e74f7d compose_box: Sensibly style disabled Send/vdots buttons. 2023-11-13 12:45:13 -08:00
Karl Stolley 609106e2d0 compose_box: Implement redesigned vdots-button styles. 2023-11-13 12:45:13 -08:00
Karl Stolley bf0e806fed compose_box: Implement redesigned send-button styles. 2023-11-13 12:45:13 -08:00
Karl Stolley f8fa47fa02 compose_box: Use columnar flex to position Drafts, limit, Send button. 2023-11-13 12:45:13 -08:00
Karl Stolley a3c1399924 compose_box: Handle compose and preview expansion. 2023-11-13 12:45:13 -08:00
Karl Stolley ec38c7b5be compose_box: Establish basic message box grid geography. 2023-11-13 12:45:13 -08:00
Karl Stolley 9f00b513f7 compose_box: Improve structures around compose buttons. 2023-11-13 12:45:13 -08:00
Karl Stolley e608a389af compose_box: Improve structures around send controls. 2023-11-13 12:45:13 -08:00
Karl Stolley b4b71880e1 compose_box: Prepare redesign send and draft structures. 2023-11-13 12:45:13 -08:00
Aman Agrawal 637e9c11ee billing: Show success text after plan change on top after reload. 2023-11-13 10:35:39 -08:00
Aman Agrawal 67bddb3d72 billing: Show success message for license change after page reload. 2023-11-13 10:35:39 -08:00
Aman Agrawal c2e01f06a3 billing: Show message for users without access to page in a white box. 2023-11-13 10:35:39 -08:00
Aman Agrawal 17573cd1fb billing: Don't show license update buttons until valid change in value. 2023-11-13 10:35:39 -08:00
Aman Agrawal 0772f8011c billing: Don't reduce button width when loading. 2023-11-13 10:35:39 -08:00
Aman Agrawal 7dc4983898 billing: Wait 300ms before updating disabled status in buttons. 2023-11-13 10:35:39 -08:00
Aman Agrawal 5429582892 billing: Don't allow negative input. 2023-11-13 10:35:39 -08:00
Aman Agrawal 2a70143050 upgrade: Show user/month plurals based on their count. 2023-11-13 10:35:39 -08:00
Aman Agrawal b516ae75db upgrade: Remove tests temporarily as they need to be rewritten. 2023-11-13 10:35:39 -08:00
Aman Agrawal 067d820a8a billing_helpers: Delete temporarily.
This needs to be re-written entirely.
2023-11-13 10:35:39 -08:00
Aman Agrawal 874d4a7026 upgrade: Improve styles for free trial upgrade. 2023-11-13 10:35:39 -08:00
Aman Agrawal 2ffae56efa upgrade: Improve styles for onboarding free trial orgs. 2023-11-13 10:35:39 -08:00
Aman Agrawal a04204e47d billing: Style go to your org better. 2023-11-13 10:35:39 -08:00
Aman Agrawal 7d10b3dcf7 upgrade: Add required fields to upgrade a realm. 2023-11-13 10:35:39 -08:00
Aman Agrawal 2f9a48cce7 upgrade: Show payment amount based on user input.
Write script to make payment amount vary with payment schedule
and number of licenses.
2023-11-13 10:35:39 -08:00
Aman Agrawal e3f20cdb8a billing: Reduce clickable area to visible button area.
Clicking outside the button also used to work for cancel plan and
other buttons in that area which can deceiving for the user.
2023-11-13 10:35:39 -08:00
Aman Agrawal f5ba6fe03c upgrade: Fix HTML structure and styles. 2023-11-13 10:35:39 -08:00
Aman Agrawal 6cadf333fb upgrade: Remove invoice payment instructions. 2023-11-13 10:35:39 -08:00
Aman Agrawal f273229b01 upgrade: Add payment button and info style with fake text. 2023-11-13 10:35:39 -08:00
Aman Agrawal 4638f67e4e upgrade: Use style similar to /billing page. 2023-11-13 10:35:39 -08:00
Aman Agrawal d3363bab96 upgrade: Add a dropdown to select billing cycle. 2023-11-13 10:35:39 -08:00
Aman Agrawal 2570f7ce23 upgrade: Control automatic / manual license management via URL. 2023-11-13 10:35:39 -08:00
Karl Stolley 690b4efca8 left_sidebar: Explicitly handle clicks on collapsible Views targets. 2023-11-13 09:33:21 -08:00
Tim Abbott 8ad2e10cfe typeahead: Fix exception trying to mention @all in DMs.
Fixes a regression in 4d1ade1f88.
2023-11-13 09:07:36 -08:00
Prakhar Pratyush 1f91db1d43 topic_mentions: Add @topic mention typeahead.
This commit adds a @topic mention typeahead that appears
only in stream messages and not in private messages.

Fixes part of #22829.
2023-11-13 09:07:36 -08:00
Prakhar Pratyush 5ec26c6542 typeahead: Fix message_type to correctly test stream mention typeahead.
This commit sets the 'message_type' to "stream" in the beginning
of the test to properly verify wildcard mentions typeahead for
stream messages.

Earlier, 'message_type' was set to "False", and the test was passing
falsely because in the 'broadcast_mentions' function, the 'else' block
gets executed for 'message_type' having a value of either
'stream' or 'False'.

```
if (compose_state.get_message_type() === "private") {
    wildcard_string = $t({defaultMessage: "Notify recipients"});
} else {
    wildcard_string = $t({defaultMessage: "Notify stream"});
    wildcard_mention_array.push("stream");
}
```

We don't need to explicitly change the condition to:
```
else if (compose_state.get_message_type() === "stream")
```
because in practise, the 'message_type' is either set to 'stream'
or 'private' when the user types a message.

Only changing the 'message_type' in the test to simulate the
actual behaviour fulfils our purpose.

This should have been included in 5bddd8f.
2023-11-13 09:07:36 -08:00
Aman Agrawal 1b804cd0dd sponsorship: Don't preserve scroll position on reload. 2023-11-13 08:52:13 -08:00
Aman Agrawal 395cafcf46 sponsorship: Add extra input fields to get more org info.
Fixes #27600
2023-11-13 08:52:13 -08:00
Aman Agrawal bf53c70dd9 sponsorship: Update discount description on page load.
Fixes part of #27645.
2023-11-13 08:52:13 -08:00
Prakhar Pratyush 64005c03b6 topic_mentions: Highlight the @topic mention for topic participants.
This commit adds support to highlight the '@topic' wildcard
mention text for the users having 'topic_wildcard_mentioned'
flag set.

Fixes #27497.
2023-11-13 08:29:16 -08:00
Tim Abbott 07769aec4b rows: Fix logic for finding drafts rows. 2023-11-13 08:29:16 -08:00
Karl Stolley 554f33d033 left_sidebar: Set shared right margin on DM section. 2023-11-13 08:27:28 -08:00
N-Shar-ma ed59316ff6 refactor: Rename `is_search` to `is_keyword_search` for clarity.
For more clarity, the 3 related functions `is_search` in `filter.js`,
`message_list.js` and `message_list_data.js` are all renamed to
`is_keyword_search`.
2023-11-13 08:09:03 -08:00
Sahil Batra d1113b5371 invite: Use ICU plural syntax for invite success message.
The message shown on successful invitation included "User(s)"
previously. This commit updates it to include "User" or "Users"
according to the number of users invited.
2023-11-13 08:07:12 -08:00
Aman Agrawal 060b94b71f inbox: Fix search icon position on narrow widths.
Due to filters dropdown's variable width, the search icon was
incorrectly positioned, we fix it by positioning it relative to
the filter dropdown.
2023-11-10 18:20:26 -08:00
Lalit b86022ea52 ts: Convert `activity.js` module to TypeScript. 2023-11-10 16:37:44 -08:00
BrandonAWong 6edf24b0f7 search: Remove "All messages" typeahead
Previously, the "All messages" typeahead would be shown whenever
the search bar had an empty input. This change removes that typeahead
completely in favor of using other filters such as -is:muted.

Fixes #27358

Co-authored-by: Heran Zhang & Wei-Cheng Sung
2023-11-10 16:27:32 -08:00
N-Shar-ma c3c72cda6d compose: Completely remove style elements when pasting HTML as markdown.
Turndown would strip `<style>` tags, but retain the content enclosed.
This resulted in unwanted content being pasted, like the comment nodes
inside the `<style>` tag when pasting cell/s copied from Google Sheets.
2023-11-10 13:56:51 -08:00
N-Shar-ma e15f518ccc compose: Always retain `ul` tag when pasting content enclosed by it.
This functionally makes no difference, but we add it along with `ol`
for consistency.
2023-11-10 13:56:51 -08:00
N-Shar-ma db9ac4b674 commit: Disable automatic numbering / bulleting when inside code block. 2023-11-10 13:56:51 -08:00
N-Shar-ma 602d1d7323 compose: Do not paste formatted markdown when inside a code block.
We usually default to pasting formatted markdown (unless the Shift key
is used to paste plainly instead), but when we're inside a code block,
we always want to paste plainly.
2023-11-10 13:56:51 -08:00
N-Shar-ma f5bcf5d608 compose: Add a function checking whether the cursor is in a code block.
This is a prep commit for the following 2 commits, so we can opt out of
the formatted paste and automatic bulleting / numbering behaviors when
inside a code block.
2023-11-10 13:56:51 -08:00
Prakhar Pratyush 2f469ff830 hotkey: Give feedback when no unreads left in followed topics.
When navigating to the next unread followed topic using
the Shift+N hotkey, we notify the user when there are no more
unread messages in followed topics.

Earlier, the hotkey simply did nothing in such a case.

We use feedback_widget to do so.

Fixes #27604.
2023-11-10 13:33:13 -08:00
Joelute 4d1ade1f88 compose: Automatically change @ mentions to silent mentions in 1:1 DMs.
It is common for users in other chat tools to start off a direct message
with @ mentioning the addressee. However, this results in potentially
unexpected behavior in Zulip, where the message is highlighted and shows
up in @ mentions in addition to DMs. We want to prevent this behaviour by
automatically changing the @ mentions to silent @ mentions for the user.
These changes only apply to 1:1 DMs and not group chats.

Fixes: #17998.
2023-11-10 12:59:44 -08:00
Prakhar Pratyush c597de6a1d topic_mentions: Rename wildcard_mentioned to stream_wildcard_mentioned.
Rename the existing 'wildcard_mentioned' flag to
'stream_wildcard_mentioned'.

The 'wildcard_mentioned' flag is deprecated and exists for
backwards compatibility.

We have two separate flags for stream and topic wildcard mentions,
i.e., 'stream_wildcard_mentioned' and 'topic_wildcard_mentioned',
respectively.

* stream wildcard mentions: `@all`, `@everyone`, and `@stream`
* topic wildcard mentions: `@topic`

The `wildcard_mentioned` flag is included in the events and
API response if either `stream_wildcard_mentioned` or
`topic_wildcard_mentioned` is set.
2023-11-10 11:06:26 -08:00
Aman Agrawal a7f02c89d7 inbox_view: Move filters dropdown to the left of search box. 2023-11-10 10:22:18 -08:00
Aman Agrawal 69d59acc5a inbox: Focus currently selected option in dropdown. 2023-11-10 10:22:18 -08:00
Aman Agrawal f191efce1b inbox: Add dropdown to filter topics.
Fixes #27522

Replace `Include muted` checkbox with a dropdown to filter displayed
topics.

Also, adds a new filter to display only followed topics.
2023-11-10 10:22:18 -08:00
Aman Agrawal 03dcb9c0e4 dropdown_widget: Add option to hide search box. 2023-11-10 10:22:18 -08:00
Karl Stolley 2557f90c01 left_sidebar: Set extra-long hover delay for Views, DMs tooltips. 2023-11-10 09:22:07 -08:00
Karl Stolley f3887f1fa7 left_sidebar: Add a Views expand/collapse tooltip. 2023-11-10 09:22:07 -08:00
Karl Stolley f8ce278e76 left_sidebar: Include DM expand/collapse tooltip on arrow. 2023-11-10 09:22:07 -08:00
Karl Stolley 5f1c9ca107 left_sidebar: Center Streams tooltip over heading text. 2023-11-10 09:22:07 -08:00
Akarsh Jain d8d70d9e43 compose_banner: Display time for messages with < 5 mins scheduled time.
This commit addresses the issue where scheduling a message for a
time less than 5 minutes in the future resulted in the confirmation
banner not displaying the scheduled time, which should have actually
been 5 minutes in the future, as enforced at the UI level by the
MINIMUM_SCHEDULED_MESSAGE_DELAY_SECONDS variable.

We remove the `is_send_later_timestamp_missing_or_expired` method along
with it's tests since `selected_send_later_timestamp` is already set to
the minimum of 5 minutes in the future through the `minDate` option of
the flatpickr.

Fixes: #26784.

Co-authored-by: Sayam Samal <samal.sayam@gmail.com>
2023-11-10 09:20:15 -08:00
Karl Stolley f2e8d2dc07 left_sidebar: Set border radius on rows for all states. 2023-11-09 17:39:26 -08:00
Karl Stolley 34475bf867 left_sidebar: Establish filter-handling grid on Streams, DM headers.
Fixes part of #27559.
2023-11-09 17:39:26 -08:00
Karl Stolley 2235413c15 left_sidebar: Establish grid on Direct Messages header. 2023-11-09 17:39:26 -08:00
Karl Stolley 12bf754a8a left_sidebar: Consolidate left-sidebar-title styles. 2023-11-09 17:39:26 -08:00
Karl Stolley 3f36c52f41 sidebars: Structurally separate left- and right-sidebar headings. 2023-11-09 17:39:26 -08:00
Karl Stolley ee32654723 sidebars: Express heading colors as CSS variables. 2023-11-09 17:39:26 -08:00
Aman Agrawal df703f847c billing: Fix free trial billing page end plan button not working. 2023-11-10 05:17:52 +05:30
Aman Agrawal bb557d5193 billing: Add different modals for increasing / decreasing licenses. 2023-11-10 05:17:52 +05:30
Aman Agrawal 3d45e7ca64 billing: Make plan cancel/renew work. 2023-11-10 05:17:52 +05:30
Aman Agrawal e185e91581 billing: Redirect to stripe card change page on clicking change card. 2023-11-10 05:17:52 +05:30
Aman Agrawal 8c4ef3e9aa billing: Temporarily remove tests.
These seem important to have but will have to be rewritten.
2023-11-10 05:17:52 +05:30
Aman Agrawal cce5666e5d billing: Make changing current and next cycle licenses work. 2023-11-10 05:17:52 +05:30
Aman Agrawal 9d7e10950f billing: Fix style of cancel button and adjust app margins. 2023-11-10 05:17:52 +05:30
Aman Agrawal d79b59d3b1 billing: Make payment method look nice. 2023-11-10 05:17:52 +05:30
Aman Agrawal f9aba9ba33 billing: Make license count management buttons look nicer. 2023-11-10 05:17:52 +05:30
Aman Agrawal a75afe1462 bililng: Style similar to sponsorship page. 2023-11-10 05:17:52 +05:30
Aman Agrawal a4425d26d2 billing: Add plan change buttons, modals and notices. 2023-11-10 05:17:52 +05:30
Aman Agrawal 2f532e49d1 billing: Add field to show billing frequency. 2023-11-10 05:17:52 +05:30
Aman Agrawal c41a8317cf billing: Convert plan name to new style. 2023-11-10 05:17:52 +05:30
Aman Agrawal b5b7fc9957 billing: Use navbar used in login/help pages. 2023-11-10 05:17:52 +05:30
Aman Agrawal 757675db80 rows: Use message under / next to sticky header for narrowing / info.
Fixes #27489

For sticky message headers, we should not use the `first_message_in_group`
for narrowing to the topic since can be out of view for the user.
2023-11-09 10:04:58 -08:00
Anders Kaseorg 9b83dc1b79 stylelint: Fix declaration-block-no-redundant-longhand-properties.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-08 16:11:15 -08:00
roanster007 273081d0a6 lightbox_view: Fix media title update on change in title.
Presently in a session when an image or video title is updated,
the same change is not reflected in the lightbox view of
them, until a new session is made.

This is because the metadata of the media is stored in Map
for the session with the preview_src as keys, and hence,
when title is changed the preview_src being same, the title
change is not reflected inside lightbox view.

This is fixed by modifing the asset_map (cache map) keys
from preview_src to an array of preview_src, and the media
title. Hence, when title is modified now, the keys won't map
to the existing value, and hence new metadata would be
shown.
A new function get_asset_map_key_for_media() introduced
to get the corresponing metadata from this asset_map
by passing in the prview_src and media elements.

Fixes #21311
2023-11-08 14:10:51 -08:00
Karl Stolley e8fe6f873e left_sidebar: Register mark-all-read handlers on all home views. 2023-11-08 14:04:58 -08:00
Aman Agrawal f6516cba89 personal_menu: Add opacity hover effect on clear status button. 2023-11-08 10:19:24 -08:00
Aman Agrawal 66276d88ef personal_menu: Add different colors for status text. 2023-11-08 10:19:24 -08:00
N-Shar-ma eca6738b00 compose: Always retain link formatting when pasting just a link.
We add anchors to the list of enclosing elements we don't strip away.
2023-11-08 09:51:33 -08:00
evykassirer c3bee2038a message edit: Use a default error message for failed edits.
Bug reported here:
https://chat.zulip.org/#narrow/stream/464-kandra-js-errors/topic/Error.3A.20The.20partial.20.40partial-block.20could.20not.20be.20found/near/1673466

The reported issue was for a message edit request, and it was
happening because `channel.xhr_error_message` can return the
empty string sometimes, and `render_compose_banner` shows the
banner text if it exists and otherwise tries to render a
`@partial-block`. Unfortunately the empty string acts as falsy
in the template, leading to the partial block error.

This commit adds a default error message that was removed
in 96680e95fb.

It also adds a check to not show an error banner at all if
`readyState` is 0, which means the request was cancelled.
2023-11-08 09:47:32 -08:00
Aman Agrawal 3a7ce432e5 popovers: Fix topic visibility popover in sticky header not working.
The popover didn't open since sticky_header is part of message feed
and we were hiding popovers if `elements_at_reference_position`
had `sticky_header`. Now, we just don't do that check if the
reference is part of sticky_header.
2023-11-08 09:17:25 -08:00
ecxtacy f2deb8da46 settings-ui: Change `<select>` style using custom chevron-down icon.
Align the `dropdown-widget` and `<select>` UIs.
Removed default `<select>` tag styles with `appearance: none` css.
Added custom chevron-down icon with `background-image` attribute
to the `<select>` tag.

The svg icon is used in a CSS variable with a data URI.
The CSS variable is used to set different colors for dark and light
theme.

Tweaked by tabbott to scope selectors appropriately and also delete a
10px font-size in one settings dropdown widget.

Fixes #26859.
2023-11-07 16:55:34 -08:00
ecxtacy 0c1f340934 settings-ui: Replace chevron-down fa-icon with svg icon.
Fixes part of #26859.
2023-11-07 16:55:34 -08:00
ecxtacy 952c5e1865 icons: Add chevron-down svg icon for dropdowns. 2023-11-07 16:55:34 -08:00
Pratik 137505e2ad settings_notifications: Enable muted stream notification settings.
This commit allow the users to modify notification settings for muted
streams through the 'notification' section located in the personal
settings.

Fixes #27272.
2023-11-07 13:46:19 -08:00
Aman Agrawal ebd0dcd5d2 actions_popover: Fix copy link not working on `enter` keypress. 2023-11-07 13:31:53 -08:00
Rahul 4dfb04d501 compose_ui: Use Intl.ListFormat rather than .join(", ").
This commit changes .join(",") to Int1.ListFormat.
This produces more accurate translations.

Refactor compose_ui.test to update the testcase for Alice and Bob.
The previous test case output of "Alice,Bob"  modify to "Alice and Bob"
to align with the behavior of Int1.ListFormat,
which joins lists using ',' & 'and'.
2023-11-07 13:18:57 -08:00
Joelute 76024e479d alerts: Fix improper copied tooltip location in About Zulip Modal.
Previously when a user tries to click on the clipboard to copy the merge
base version info, the copied tooltip would appear in the wrong location
where the Zulip version is instead. This is caused by both clipboard
icon using the same Clipboard instance where the success event would only
display the tooltip at the Zulip version. These changes fixes this and
allows the clipboards to be independent of each other.
2023-11-07 13:17:55 -08:00
David Rosa b5351285b6 help: Document "Jitsi server URL" setting.
- Updates "Start a call", documents the "Jitsi server URL" setting,
  and links to it in a (?) from the relevant admin UI.
- Fixes misplaced include block for opening the compose box.

Fixes #26907.
2023-11-07 13:09:52 -08:00
N-Shar-ma ff5e389e9b compose: Allow pasting plainly, when Shift is held down, for Firefox.
We introduce a state variable `shift_pressed` for the purpose of
detecting whether the Shift key is pressed when pasting content. Only if
it is not, do we proceed with the default formatted paste behavior.

In Chrome, plain paste works out of the box for `Ctrl+Shift+V`, but in
Firefox, we need to handle it ourselves.
2023-11-07 11:39:06 -08:00
N-Shar-ma dac56b4d08 compose: Paste content into the compose box without adding any space.
We replace the call to `insert_syntax_and_focus` with a direct call to
`insert_and_scroll_into_view` when pasting content into the compose box,
which fixes the bug where leading and trailing spaces were added to any
pasted content.
2023-11-07 11:39:06 -08:00
N-Shar-ma 24e8119350 compose: Always retain `ol` tag when pasting content enclosed by it. 2023-11-07 11:39:06 -08:00
Aman Agrawal 25877114cf popover_menus: Move popoover to top if focused on text field.
Fixes #11448

Tested on Chrome, Firefox (iOS, Android) and Safari (iOS).
2023-11-07 11:31:10 -08:00
Aman Agrawal 75960bba16 emoji_picker: Don't autofocus search input on mobile.
Since focus on input elements on mobile opens keyboard which
changes window height, emoji popover can hide or scroll out of
view. To fix it, we don't focus on search input unless user
wants to when emoji popover is open.
2023-11-07 11:31:10 -08:00
Aman Agrawal 6e9da8ab2a popover_menus: Only take special care of references in message feed.
If the popover reference is in an overlay, the below check:
```js
elements_at_reference_position.some(
    (element) =>
        element.id === "navbar-fixed-container" ||
        element.id === "compose-content" ||
        element.classList.contains("sticky_header"),
)
```
would make the popover not appear if the reference was above them.

To make things simpler for us to check, we only handle popover
references inside message list which we know for sure will
always be below the elements checked above in stacking context.

Hiding popovers for other view is done good enough by
`data-reference-hidden` check that we don't need to manually
handle them.
2023-11-07 09:23:48 -08:00
Aman Agrawal a4b4b0ad38 popover_menus: Fix popovers not shown if reference is beside compose.
Since `#compose` occupies full width of the window, it is a
part of `elements_at_reference_position` if the reference is
under it.

Since `#compose-content` only occupies the part of window where
compose box is actually visible, we use it decide if the
popover should be hidden.
2023-11-07 09:23:48 -08:00
evykassirer 8cf436370c stream search: Always close search on Escape.
Fixes #27491.
2023-11-06 15:10:23 -08:00
evykassirer b51da3bb9a hotkey: Close text fields before closing sidebar.
Before this change, we'd try to close the sidebar before
closing text fields. This means if the user sidebar was
open with a text search in progress, pressing Escape
would close the full sidebar instead of closing search.

This change deprioritizes closing the sidebar, in favor
of closing input fields like search.

This also helps with #26717, because the sidebar seems to
be marked as open even when it's not an overlay, which
means pressing Escape will first "close" it (no visual
changes), before a second Escape would trigger closing
the search field. Ideally we differentiate between
situations where we are showing the sidebar as an
overlay and when we aren't, but that might be a more
involved change.
2023-11-06 15:10:23 -08:00
evykassirer ac0e03fe89 user search: Always close widget on escape instead of clearing first.
Fixes part of #27491
2023-11-06 15:10:23 -08:00
evykassirer a764a3e66f more topics: Escape clears input when input is focused.
Fixes part of #27491

We don't immediatley remove the input box, because there's
no existing UI for reopening the input box. (The input box
is always visible when the more topics view is visible.)

This commit makes the change of blurring and clearing the
input, instead of only blurring.
2023-11-06 15:10:23 -08:00
Aman Agrawal 1c03d5e5ce gear_menu: Don't show sponsorship link for orgs on paid plan. 2023-11-06 14:55:14 -08:00
Aman Agrawal 48c907e1a2 gear_menu: Show Zulip Cloud Plus for orgs on that plan.
Fixes #27525
2023-11-06 14:55:14 -08:00
Aman Agrawal e8c70a71d9 gear_menu: Show options based on sponsorship status.
Includes some additional tweaks for when to show various
billing related options.

Fixes #27524
2023-11-06 14:55:14 -08:00
Aman Agrawal 4fef63de52 sponsorship: Show error message for the field under the field. 2023-11-06 14:55:14 -08:00
Aman Agrawal b5fd5f2f5e sponsorship: Minor changes.
Wrap sponsored / sponsorship pending message in a white box.
Remove green heart.
2023-11-06 14:55:14 -08:00