Commit Graph

605 Commits

Author SHA1 Message Date
Anders Kaseorg 1efc6efd23 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-01 18:52:00 -08:00
Anders Kaseorg 9c7453c11e people: Downgrade get_user_time error to warning.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-30 12:36:06 -08:00
Aman Agrawal 47cdffb5fb recent_view: Drop unread header for spectators. 2023-11-29 21:47:36 -08:00
Sahil Batra 7da68259a6 presence: Do not raise blueslip error for presence data of unknown user.
We have already fixed the actual bugs that were resulting in client
receiving presence data for unknown user, so we can remove the
blueslip logging and just skip the unknown users.
2023-11-29 12:01:37 -08:00
Sayam Samal 9191f1a7eb uploads: Extend drag and drop upload area to the navbar. 2023-11-29 10:35:18 -08:00
Sayam Samal def4cf7f93 uploads: Extend drag and drop upload area to blank areas after sidebars.
To extend the drag and drop upload area to blank areas after sidebars,
we now detect the drag/drop event on the entire ".app" division.

We also change replace `width` and `height` css properties with
`min-width` and `min-height` properties respectively, to make sure
that the ".app" div spans the entire width and height of the viewport.

Fixes: #27550.
2023-11-29 10:35:18 -08:00
Anders Kaseorg 07bd1f28d1 time_zone_util: Avoid relying on timeZoneName: "longOffset".
Safari doesn’t support it yet.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-29 09:57:10 -08:00
evykassirer 32c730e530 emoji: Fallback to Google Modern for unsupported new Twitter emoji.
The Twitter emoji team was laid off in 2022, so new emoji aren't supported.
https://github.com/twitter/twemoji/issues/570#issuecomment-1303422143.
The "twitter" sprite sheet we’re using does have images in those locations,
but they’re fallback images that emoji-datasource fills in from the Apple
sprite sheet, which has unclear licensing implications.

To be able to support newer emoji, we fallback to Google Modern for any emoji
not covered by Twemoji.

CZO conversation:
https://chat.zulip.org/#narrow/stream/107-kandra/topic/emoji.20changes.20in.208.2E0/near/1689918
2023-11-28 23:46:49 -08:00
N-Shar-ma 9d3a606bfb compose: Add banner to go to conversation when replying in search view.
When a user is replying to a message while in a search view, we now warn
them that the full conversation is not visible and urge them to go to
the conversation they are composing to, so they can see the complete
conversation. On narrowing to that conversation, the banner is removed.

Fixes: #25893.
2023-11-28 16:55:05 -08:00
Anders Kaseorg 06c2b89525 timerender: Use an explicit time zone for all rendering.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-28 16:54:00 -08:00
Anders Kaseorg 33e335dbd1 time_zone_util: Add zoned date/time utility functions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-28 16:54:00 -08:00
Tim Abbott 39fb1a0f70 message_fetch: Fix get_frontfill_anchor fallback.
This fixes a very rare exception seen in production, which the
previous assertion allowed us to understand was possible in a rare
race, now documented in comments.
2023-11-28 15:08:00 -08:00
Prakhar Pratyush 451ddf4c84 typeahead: Show @-topic typeahead whenever it might be possible to use.
Earlier, when a topic had less than 15 participants,
the @-topic typeahead was not visible. It should be visible
irrespective of the 'realm_wildcard_mention_policy' setting
when the participant count is not greater than 15.

The participant count for a topic can't always be calculated
accurately in the client as some of the messages might still
be loading.

We show @-topic in the typeahead whenever it might be possible
to use it.

We will give an error later if you aren't allowed to use it.

Fixes #27852.
2023-11-28 09:24:18 -08:00
Prakhar Pratyush 590d43f475 mentions: Rename 'stream_wildcard_mention_allowed_in_large_stream'.
This prep commit renames:
* 'stream_wildcard_mention_allowed_in_large_stream' to
'wildcard_mention_policy_authorizes_user' because the function
checks if the sender is allowed to use wildcard mentions based
on the 'wildcard_mention_policy' setting, and we plan to use that
for topic wildcard mentions too.

* 'stream_wildcard_mention_large_stream_threshold' to
'wildcard_mention_threshold' because this value is going to be
used as a threshold value for the max number of subscribers and
participant count allowed for stream and topic wildcard mention
respectively.
2023-11-28 09:24:18 -08:00
Aman Agrawal fce35fc53b recent_view: Show checkbox icon for unread filter.
I accidentally removed the filter_unread parameter passed to the
template.
2023-11-27 07:57:42 -08:00
Prakhar Pratyush 9c5cfe83ba desktop_notification: Fix bad rendering of math formulas.
Earlier, for the desktop notifications having latex math
like "$$1 \oplus 0 = 1$$, the notification had the math
included multiple times.

This commit fixes the incorrect behavior by replacing
the KaTeX with the raw LaTeX source.

Fixes #25289.
2023-11-26 23:30:24 -08:00
Riken Shah 8d633cc368 hotspot: Add backend changes for non-intro hotspots.
This commit introduces non-intro hotspots.
They are a bit different than intro hotspots in the
following ways:

* All the non-intro hotspots are sent at once instead of
sending them one by one like intro hotspots.

* They only activate when a specific event occurs,
unlike intro hotspot where they activate after the
previous hotspot is read.
2023-11-24 07:49:24 -08:00
Prakhar Pratyush 0c159c5f47 mention: Fix mention highlighting in unsubscribed streams.
Rules followed:
1. Bold and highlighted background if the mention was processed
as a mention that includes you.
2. Bold personal mention (but not highlighted) if you were mentioned
but not subscribed at the time.
3. Otherwise not bold, no highlighting.

As we plan to keep the mention pill CSS the same if a user
was mentioned via that personal/wildcard/usergroup mention
irrespective of whether the user is subscribed or not, we use
usermessage flags to determine when to add 'user-mention-me' class.

Fixes #27654.
2023-11-24 07:10:20 -08:00
Prakhar Pratyush 49388d5d3d topic_mentions: Fix restriction rule for @-topic mentions.
Now, the topic wildcard mention follows the following
rules:
* If the topic has less than 15 participants , anyone
can use @ topic mentions.
* For more than 15, the org setting 'wildcard_mention_policy'
determines who can use @ topic mentions.

Earlier, topic wildcard mentions followed the same restriction
as stream wildcard mentions, which was incorrect.

Fixes part of #27700.
2023-11-23 12:52:25 -08:00
Prakhar Pratyush 31a731469d stream_mentions: Update compose banner text when @-stream restricted.
We simplify the banner message by replacing the
"stream wildcard mentions" text with `"@stream mentions`,
`"@-all mentions"`, or `"@-everyone mentions"` text.
2023-11-23 12:52:25 -08:00
Sahil Batra 189718dc64 settings: Add support to change user-access setting in development.
This commit updates the backend code to allow changing
can_access_all_users_group setting in development environment
and also adds a dropdown in webapp UI which is only shown in
development environment.
2023-11-23 10:40:42 -08:00
Aman Agrawal 1e7b4ae160 recent_view: Add drodown widget to filter topics. 2023-11-22 23:38:52 -08:00
Aman Agrawal 26f7f9d3d8 recent_view: Remove `All` filter.
Fixes #27588

Co-authored-by: cherish2003 <saicherissh90@gmail.com>
2023-11-22 10:31:26 -08:00
Julia Bichler f74721d926 compose: Allow un-toggle for links.
When toggling off link formatting, it is assumed that the description
does not contain [ and ] characters, and the url does not contain ( and
) characters.

Co-authored-by: N-Shar-ma <bablinaneh@gmail.com>
2023-11-21 21:01:17 -08:00
Julia Bichler 2db8563a7e compose: Format button for spoilers.
Note that toggling off spoiler formatting works if either all the
content inside, or the header (if it exists) or both are selected.

Co-authored-by: N-Shar-ma <bablinaneh@gmail.com>
2023-11-21 21:01:17 -08:00
Julia Bichler df143137ef compose: Format button for code.
Note that toggling off, only works for code blocks without a specified
language. So toggling formatting off only works for code blocks like:
```
code
```
and not:
```javascript
code
```

Co-authored-by: N-Shar-ma <bablinaneh@gmail.com>
2023-11-21 21:01:17 -08:00
Julia Bichler a872ab2a1a compose: Format button for quotes.
Co-authored-by: N-Shar-ma <bablinaneh@gmail.com>
2023-11-21 21:01:17 -08:00
Julia Bichler c83af7c304 compose: Format button for latex.
Co-authored-by: N-Shar-ma <bablinaneh@gmail.com>
2023-11-21 21:01:17 -08:00
Julia Bichler 63e5e05643 compose: Format button for strikethrough. 2023-11-21 21:01:17 -08:00
Aman Agrawal 3471e84d7f hotkey: Fix emoji popover not triggered in a narrow width range.
We don't show emoji icon on message on width range even if the
logged in user is not the sender, which causes popover to not
be displayed since the reference is not visible.

To avoid such case in future, we just check if the emoji icon is
visible and if not fallback to the ellipsis icon for reference.
2023-11-21 20:56:31 -08:00
N-Shar-ma 2c318b680b compose: When editing message/s, quote into the last focused edit box.
Until now, when a user quoted and replied to a message, even while
editing another, the quote would be inserted into the compose box. There
was no way to quote into the edit box.

Detecting the edit box to add content too was tricky, since on opening
the message actions popover, that message would be selected, while the
edit box would lose focus.

Now we don't shift focus on opening the message actions popover, keep
track of the last focused textarea and add the quote content to it if
if it's still in the DOM (if the user has not cancelled the editing).

Fixes: #20380.
2023-11-21 11:20:13 -08:00
N-Shar-ma 0d4a74b2c2 compose: Allow `message_id` to be passed into `quote_and_reply`.
Up until now, the currently selected message was the one that was always
quoted. Now if there's a message_id passed in, we'll quote that message
instead, otherwise we'll fall back on the selected message.

This is a prep commit for allowing quoting and replying while editing a
message sent earlier.
2023-11-21 11:20:13 -08:00
N-Shar-ma 5ba178a54f compose: Allow `message_id` to be passed to `respond_to_message`.
Up until now, the currently selected message was the one that was always
responded to. Now if there's a message_id passed in, we'll use that
message instead, otherwise we'll fall back to the selected message.

This is a prep commit for allowing quoting and replying while editing
a message sent earlier.
2023-11-21 11:20:13 -08:00
Prakhar Pratyush 768be7d46d topic_mentions: Fix the incorrect large @-mention notification warning.
Earlier, a 'large @-mention notification' warning that pops up
for stream wildcard mentions was shown for topic wildcard mentions
too, which is incorrect.

This commit fixes the incorrect behavior. We no longer show the
banner for @-topic mentions.

We don't need a banner for @-topic mentions, as those are much less
likely to be used without thinking about it and would rarely be spammy
for a lot of people.

Fixes #27767.
2023-11-21 09:20:56 -08:00
Karl Stolley ae146c3df7 left_sidebar: Grid 'Back to streams' with unread count.
This also hides the usual STREAMS header when zoomed in to more
topics.
2023-11-21 09:16:43 -08:00
evykassirer 02845a1d59 buddy list: Rename key to more accurate user_id. 2023-11-21 08:49:52 -08:00
evykassirer 6481771301 activity_ui: Pass narrow_by_email during initialization.
Like with the left sidebar, this helps avoid circular imports when we
make this module's behavior dependant on narrowing state.
2023-11-21 08:49:10 -08:00
evykassirer 74e66b71ac buddy list: Rename sel variables to selector to avoid abbreviations. 2023-11-20 15:40:42 -08:00
evykassirer aa9d69c728 stream settings: Include section for right panel in the URL.
Fixes #21017.
2023-11-20 15:32:29 -08:00
Aman Agrawal 09009ab03a upgrade: Separate add card and purchase upgrade flow.
We now let user add / update card in a separate session and then
charge users after clicking on the purchase button.
2023-11-20 12:04:56 -08:00
Tim Abbott 08b5bcbdb1 message_list: Remove stale group_date_html calculation.
This has been dead code since b746823e2e
and consumed nontrivial resources.
2023-11-20 08:33:29 -08:00
Anders Kaseorg 8a875b119f people: Remove final use of date-fns-tz.
date-fns-tz does not handle daylight saving time correctly, and can be
replaced with modern browser APIs.

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 4740a58318 top_navbar: Match navbar icons to left sidebar navigation. 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
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
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