Commit Graph

57251 Commits

Author SHA1 Message Date
Alex Vandiver 7de527f3bc soft_deactivation: Use much faster bulk_insert_all_ums.
As noted in the docstring for `bulk_insert_ums`, this is at least one
order of magnitude faster than using `bulk_create`.  This also
includes a `ON CONFLICT DO NOTHING` which allows multiple
soft-reactivations to run at once without failing.  We also adjust the
update of `last_active_message_id` to be safe against races.
2024-03-26 10:52:37 -07:00
Alex Vandiver 7988aad159 user_message: Use INSERT ... ON CONFLICT for historical UM creation.
Rather than use a bulk insert via Django, use the faster
`bulk_insert_all_ums` that we already have.  This also adds a `ON
CONFLICT` clause, to make the insert resilient to race conditions.

There are currently two callsites, with different desired `ON
CONFLICT` behaviours:
 - For `notify_reaction_update`, if the `UserMessage` had already been
   created, we would have done nothing to change it.
 - For `do_update_message_flags`, we would have ensured a specific bit
   was (un)set.

Extend `create_historical_user_messages` and `bulk_insert_all_ums` to
support `ON CONFLICT (...) UPDATE SET flags = ...`.
2024-03-26 10:52:37 -07:00
Alex Vandiver 52e3c8e1b2 user_message: Move create_historical_user_messages to zerver.lib.user_message.
It is not even used in zerver.actions.create_user.
2024-03-26 10:52:37 -07:00
Sahil Batra 19a7c75400 settings_components: Convert to typescript. 2024-03-26 10:32:15 -07:00
Sahil Batra b088f56bf7 settings_components: Fix code for parsing to numbers.
This commit updates the code for parsing strings to
numbers to use correct types -
- Number.parseInt and Number.parseFloat take strings
as inputs but we were passing Number objects.
- We were using string as an operator for "*" arithmetic
operation, which is incorrect.

This commit fixes the above mentioned things and would
be helpful when we convert settings_components file to
typescript.
2024-03-26 10:27:53 -07:00
Sahil Batra bb2a574aa8 settings: Refactor get_realm_time_limits_in_minutes.
THis commit refactors get_realm_time_limits_in_minutes
code to not convert the setting value to integer and just
keep it string. This change will help us in not defining
the type of the variable as "number | string" when we can
easily use the string values.
2024-03-26 10:27:53 -07:00
Alya Abbott b79040d752 help: Update documentation on authentication methods.
Also fix error on SSO with SAML line on /plans.
2024-03-26 09:09:36 -07:00
Eklavya Sharma 876366c6a7 docs: fix pronoun use in hindi translation guide.
Recommend the use of formal second-person pronouns in the Hindi
translation guide.
2024-03-26 09:08:09 -07:00
Aditya Bajaj 484ef17afc subscriptions: Fix broken UI for subscriber and member search.
Fix overlapping UI layout for stream subscribers search
on screens smaller than 320px. Break the search field
to a new row in the layout. Also fix the same issue in
the group settings > members panel.

Fixes #29368
2024-03-26 09:05:19 -07:00
Aman Agrawal 545e912a75 landing_navbar: Add `Semsee` case study link in mobile navbar.
This was missed in #29019.
2024-03-26 09:04:33 -07:00
Alex Vandiver 04f4e74709 kandra: Enable per-object metrics from rabbitmq.
These default to off, because in situations with thousands of queues,
consumers, and producers, they cause unreasonable overhead.  Our use
case has few enough queues that we do want to be able to inspect them
individually.

Enable per-object Prometheus metrics, per [1].

[1]: 78851828ec/deps/rabbitmq_prometheus (configuration)
2024-03-26 09:04:02 -07:00
Vector73 ea5b6be433 navbar_alert: Fix wierd closing of profile-missing-required alert.
This is a follow-up for #28924 to fix weird closing behavior of navbar alert which
is used to show the presence of empty required profile fields.
2024-03-26 09:03:16 -07:00
evykassirer 38b2988e0f buddy list: Fix issue where unread marker overlaps triple-dot.
Screenshot and original bug report here:
https://chat.zulip.org/#narrow/stream/9-issues/topic/Right.20sidebar.20bugs/near/1765231
2024-03-25 16:57:50 -07:00
evykassirer ad35d2a487 buddy_list: Use hide classname instead of user-with-count.
There seem to be two different ways of making the unread
marker visible:

(1) `user-with-count` classname on the `user_sidebar_entry`
element, which is added on render and not modified after
render at all.

(2) `hide` classname, which is toggled on the `unread_count`
element in `update_unread_count_in_dom`.

This creates a bug where sometimes the buddy list doesn't
update when messages are marked unread. This actually
doesn't always happen, since if there was an unread marker
that was there on the original render (and then removed
and put back) it will display again.

This commit keeps the `hide` class and removes the
`user-with-count` strategy.
2024-03-25 16:57:50 -07:00
Sayam Samal 51ed6a4d7b popover_menus: Extend arrow based navigation to tabbable components.
Instead of only checking for visible `a` tags, we should also check
for visible elements with the `tabindex=0` attribute defined. This
allows us to support navigation for other components which we
explicitly set to be tabbable.
2024-03-25 16:31:55 -07:00
Sayam Samal d469d37d14 personal_menu: Add theme switcher to personal menu popover.
This commit introduces a theme switcher feature within the personal
menu popover. The implementation begins with the development of a
tab picker, which has the following features:

* Utilization of radio buttons to emulate the tab picker.
    Radio input buttons provides the native way in HTML to select one
    value out of a set.

* Support for both horizontal (default) and vertical orientations.
    Vertical orientation can be achieved by appending the
    `.tab-picker-vertical` class.

* Respects the `prefers-reduced-motion` option set by the user.
    Disables the sliding tab animation to improve accessibility.

Additionally, the theme switcher component incorporates error handling
mechanisms. In the event of a server/network error, the tab slider
reverts to the previous theme option after a delay of 500ms. This
behavior visually communicates the occurrence of an error to the user,
improving the UX.

Fixes: #22803.
2024-03-25 16:31:55 -07:00
N-Shar-ma 9cedf0e8bc compose: Trigger language typeahead on using code formatting button.
To increase the discoverability of the possibility of specifying the
language for a code block, we trigger the language typeahead when code
syntax is added using the code formatting button. A blank option is
shown preselected in the typeahead, so that pressing enter will not
mistakenly add a language to the code block.

We only trigger the typeahead on empty opening fences when added by the
button, by setting a state variable to true when adding the syntax using
the button, checking for this state when sourcing languages for the code
typeahead, and then resetting the state variable to false.

Fixes: #29150.
2024-03-25 16:30:03 -07:00
N-Shar-ma 4f051d653c typeahead: Don't hide typeahead on blur if focus is back in the input.
Now we don't hide the typeahead if the focus is back in the input within
150 ms. This is common when using the compose formatting buttons, which
only momentarily take the focus away from the input.

This is a prep commit for the next, to show typeahead on adding code
syntax with the code formatting button.
2024-03-25 16:30:03 -07:00
N-Shar-ma fb25027cfb compose: Refactor `format` function to return a boolean.
The inline `format` function defined in `format_text` function` now
returns true if formatting was added rather than removed, else false.

This is a prep commit for the upcoming change to show typeahead on using
the code formatting button to add code formatting to any selected text.
2024-03-25 16:30:03 -07:00
N-Shar-ma f800d4404e compose: Redesign the arrow between stream and topic.
The icon is now bigger, slimmer in stroke width, lighter in color, and
has less horizontal spacing around it.

Fixes: part of #28792.
2024-03-25 16:12:32 -07:00
Anders Kaseorg 9015cd7da3 apt-repos: Use Ubuntu 22.04 Teleport repo on Ubuntu 22.04.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2024-03-25 17:57:24 -04:00
Kislay de8d664830
templates: Add missing translation tags.
Several of these were found via an audit by Tim Abbott.
2024-03-25 13:26:11 -07:00
Vector73 7bd893915d css: Fix css styling in "profile-settings-form".
This is a follow-up for #28924 to fix css issues related to border around
required custom-profile-fields.
2024-03-25 13:23:19 -07:00
Anders Kaseorg 9080d583df oneclickapps: Upgrade DigitalOcean 1-Click App to Ubuntu 22.04.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2024-03-25 13:19:09 -07:00
Alex Vandiver 08dd8a41e6 puppet: Fix arrow alignment. 2024-03-25 12:57:25 -07:00
Alex Vandiver 57f8b48ff9 puppet: Switch from top-level fact variables to facts dict.
This is linted by more recent puppet-lint.
2024-03-25 12:57:25 -07:00
Tim Abbott d6c91cb7f9 Revert "ci: Disable 8.0 upgrade suite to unbreak CI."
This reverts commit 51773d55ed.

Supposedly https://github.com/apache/arrow/issues/40744 is fixed.
2024-03-25 10:47:41 -07:00
Alex Vandiver a7ec7e924e import: Skip "active" check, and analytics, for crossrealm bots.
The bots do not exist in the user table to look up their active
status, and attempting to import them into the analytics table will
result in duplicate rows.
2024-03-25 10:21:48 -07:00
Tim Abbott 51773d55ed ci: Disable 8.0 upgrade suite to unbreak CI.
As noted in the comment, hopefully we get to revert this tomorrow, but
it still seems worth doing so that PRs can pass CI again.
2024-03-24 21:19:16 -07:00
Tim Abbott 2980d14cb4 scripts: Use Apache Arrow from Groonga repository.
This lets us avoid CI failures related to that repository's signing
key having expired. See https://github.com/apache/arrow/issues/40744.
2024-03-24 20:46:24 -07:00
Prakhar Pratyush e5d50d9787 message_list_tooltips: Fix code style issue.
frontend-lint was failing due to code style issue
in 'message_list_tooltips'.

This was introduced in fd3c7728fc.
2024-03-22 22:35:15 -07:00
Alya Abbott 2514093688 docs and help: Update text of no-content mobile notifications.
Documentation follow-up to d9c5eb1280.
2024-03-22 18:16:24 -07:00
Robert Dyer eb2f1b4788 docs: Upgrade development environment page to use synced tabs.
This greatly reduces how much content for other platforms a reader has
to scroll past in order to get the development environment set up.
2024-03-22 16:54:57 -07:00
Robert Dyer 40bab84e8f docs: Fix some outdated links from development environment guide. 2024-03-22 16:54:57 -07:00
Robert Dyer 5768d27116 docs: Update VNU filter to ignore warnings about sphinx-design. 2024-03-22 16:54:57 -07:00
Temidayo32 533a6153b2 compose_validate: Convert module to TypeScript. 2024-03-22 15:59:37 -07:00
Varun Singh fd3c7728fc message_list_tooltips: Convert module to TypeScript. 2024-03-22 15:37:57 -07:00
Varun Singh b0377d5d6d message_list_tooltips: Create '$template' conditionally.
We only expect 'data-tooltip-template-id' to be present if 'tippy_content'
is not valid.Hence, only when 'tippy_content' is undefined, should we create
'$template'.
2024-03-22 15:37:57 -07:00
Varun Singh 92ba149f5f message_list_tooltips: Consistently pass 'target' as 'string' argument. 2024-03-22 15:37:31 -07:00
Varun Singh 92c8b89ce2 message_list_tooltips: Return 'undefined' to satisfy tippy upstream. 2024-03-22 15:35:49 -07:00
N-Shar-ma b6a04aaa83 typeahead: Add option for word order not mattering for query matching.
Uptil now, the `query_matches_string_in_order` function would respect
the order of words in the query string when matching a source string.
This meant that for query "two one", the source string "one two three"
would not be matched.

For more flexibility, a new function, `query_matches_string_in_any_order`,
has been added., which returns true if each word in the query string matches
the prefix of a distinct word in the source string, else it returns false.

The algorithm for computing this is quadratic in terms of the source word
count so can be a little expensive, but it is only currently used for
searching topics in Recent Conversations, where the strings' length is
limited by the max stream / topic name length allowed, so this should be
performant enough for this use case.
2024-03-22 15:20:40 -07:00
N-Shar-ma c503a846ba refactor: Rename `query_matches_string` to `query_matches_string_in_order`.
The function is renamed for clarity.

Prep commit for next commit which adds a similar function where order
does not matter.
2024-03-22 15:20:40 -07:00
N-Shar-ma 5d83e53ca5 typeahead: Treat query and source string in the same way before matching.
Like the source string, now the query too is converted into lower case
and has diacritics removed, before trying to determine a match.
2024-03-22 15:20:40 -07:00
Anders Kaseorg 0cc40605b0 semgrep: Broaden select_related() and prefetch_related() rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-22 18:01:57 -04:00
Aditya Bajaj a20b454ebb
notifications: Shorten string for redacted content.
Replace the long string for organisations that have notification
body/content disabled (settings.PUSH_NOTIFICATION_REDACT_CONTENT
set to true) with "New message".

This allows more of the limited space on the mobile device screen to
be used for additional messages rather than this verbose content.

Fixes #29152
2024-03-22 09:37:51 -07:00
Alex Vandiver 92fa9ee78c util: Use the same regex as the backend for wildcard mentions. 2024-03-22 09:36:12 -07:00
Mateusz Mandera 89a22fb076 register_server: Check write access to secrets file when rotate_key.
Using --rotate-key without write access to the secrets file is currently
quite painful, since you end up rotating your registration's secret with
no local record of it; so effectively you lose your registration and
need help from support. We should just prevent this failure mode.
2024-03-22 09:33:00 -07:00
Alex Vandiver 7d0c12aa3a semgrep: Enforce no bare select_related() calls.
Previously, #26419 addressed the majority of these calls, but did not
prevent more from creeping in.  Remove the one remaining
callsite (after the cleanup from the previous commits), and ban any
future use of the pattern.
2024-03-22 09:30:17 -07:00
Alex Vandiver fd5a091b30 messages: Only check the UserMessage row if necessary.
For the common case of not needing to reference the UserMessage row
later, and for being a stream without private history, the UserMessage
row is irrelevant.  Convert `has_user_message` to a thunk, and defer
loading it unless necessary.
2024-03-22 09:30:17 -07:00
Alex Vandiver f92d43c690 messages: Use overloads to only return a user_message if needed. 2024-03-22 09:30:17 -07:00