Commit Graph

57181 Commits

Author SHA1 Message Date
Varun Singh a101e161dc submessage: Parse 'events' array data with zod.
The 'events' array in 'get_message_events' is made of objects.
Each object has 'data' field which is of type 'any' because
'JSON.parse' returns 'any'. We need to parse it using zod
to add type-safety.

The reason I am parsing the entire array at once is because,
'events' array is made of objects of two different schema; and
the order matters. The first element is of different schema than
the rest.(.tuple().rest() used is for that purpose).

This validates the entire submessage content before it is passed to
'widgetize.ts'.
2024-03-28 12:59:12 -07:00
Varun Singh 195bb4d13b zform: Move zod schema to avoid dependency cycle.
We need to validate the events array in 'submessage.js' using
zod. One of the schema needed is 'zform_widget_extra_data_schema'
in zform. If we import it inside 'submessage', it creates a
dependency cycle ; zform.js=>transmit.js=>server_events.js=>server_events_dispatch.js.
server_events_dispatch.js=>submessage.js=>zform.js

Hence I have moved the schema inside 'submessage' and imported it
inside 'zform.js'.
2024-03-28 12:59:12 -07:00
Varun Singh 3eb1a11725 zform: Add missing field in zod schema. 2024-03-28 12:59:12 -07:00
Varun Singh 7329100dc7 submessage: Send only relevant 'event' array data.
We sent entire 'events' array to 'widgetize.activate' and then
removed its first element(using .shift()); instead we should
send only relevant data ie. the entire array after the first element.

This also helps us avoid an extra check in node tests.
2024-03-28 12:59:12 -07:00
Varun Singh 2e8b950022 submessage: Remove redundant 'parseInt' statements.
As per 'Submessage' type in 'types.ts' , 'id' field is of type 'number'.
Hence we don't need to parse it.
2024-03-28 12:59:12 -07:00
Sahil Batra 85d0c0d7dd settings: Refactor code to handle authentication methods.
This commit refactors code to handle authentication methods
so that we need not update the type returned for
"realm_authentication_methods" by get_property_value
to be something different than what is the type for
realm object.

This change essentially means that we do not use the value
returned by get_property_value for authentication methods and
directly call realm_authentication_methods_to_boolean_dict.

Follow up to #29264.
2024-03-28 12:12:52 -07:00
Prakhar Pratyush a0cec2c378 stripe: Skip invoice overdue mail for free plans with no next plan.
Earlier, if a free plan (say legacy plan) with no next plan scheduled
was invoiced, we used to send an invoice overdue email if the last
audit log update is stale.

Actually, we don't need this data as the invoice step is just going
to downgrade the current plan. We should not wait for customer to
start uploading data in this case. Skip the email sending step and
invoice the plan to downgrade.
2024-03-28 09:29:23 -07:00
Anders Kaseorg 36b8462796 status_emoji: Remove extra space with Handlebars whitespace control.
This gets rendered into a comma-separated list, and the extra space
was ending up before the comma.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:11:09 -07:00
Anders Kaseorg f0945518ba inbox: Remove flexbox nonsense from user rows.
There was no reason for this to be a flexbox, and it was interfering
with wrapping of long names.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:11:09 -07:00
Mateusz Mandera c3caa3ecc8 stripe: Rename @error_handler decorator.
This decorator, among other things, transforms the "event" argument
passed when calling the decorated functions into actually passing
event.content_object.

So e.g. despite having a (before the decorator is applied) signature:

```
def handle_invoice_paid_event(stripe_invoice: stripe.Invoice, invoice: Invoice) -> None:
```

these are called passing an `Event` in the second arg when calling
`handle_invoice_paid_event`:

```
handle_invoice_paid_event(stripe_invoice, event)
```

I found that kind of confusing because the @error_handler decorator
didn't sound like something that would intervene in the arguments like
that. So it feels helpful to rename it something with a less modest
name, that makes it sound like it does more than just pure
error-handling.
2024-03-28 09:10:09 -07:00
Anders Kaseorg db1f69e72f compose_validate: Simplify away extra stream_data lookups.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Anders Kaseorg 48e836f01c compose_validate: Explode validation_error into individual functions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Anders Kaseorg 807a4428f6 compose_validate: Remove autosubscribe feature.
This was only used in the undocumented narrow_stream mode, and relied
on a deprecated synchronous XHR request.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Prakhar Pratyush a7dc7c0734 message: Add function to remove single newline in triple quoted string.
For multiline strings in triple quotes, a '\n' is included
at the end of each line.

Earlier, to skip '\n' we used to add an escape character '\'
at the end of each line.

This commit adds a function to avoid manually adding '\'.
2024-03-28 09:03:59 -07:00
Anders Kaseorg bd4a095fc3 inbox_ui: Sort names, not HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-27 14:22:24 -07:00
Aman Agrawal bec8fccf75 right_sidebar: Hide underline from user-list toggle button in navbar. 2024-03-27 13:29:16 -07:00
Tim Abbott 3847740a2a settings: Sort various enumerations of settings fields. 2024-03-27 12:58:32 -07:00
Karl Stolley 286d44bf33 settings: Add new web information density settings.
Note that these settings are not operative at present, and are only
visible in the settings UI in the development environment.
2024-03-27 12:58:32 -07:00
Tim Abbott 8f0f41e236 pythonrc: Add various frequently handy imports. 2024-03-27 12:49:24 -07:00
Prakhar Pratyush 3add31496f puppet: Add a daily cron-job to send zulip update announcements.
A daily cron job is configured to run the
'send_zulip_update_announcements' management command.
2024-03-27 11:43:08 -07:00
Prakhar Pratyush b9d9676b43 zulip_news: Update the group DM sent initially to admins.
As a part of the zulip news feature, we send an initial
group DM to admins suggesting them to update or set
the 'zulip_update_announcements_stream'.

This commit updates those messages to make it better.
2024-03-27 11:42:00 -07:00
Lauryn Menard c53a96a7b0 i18n-test: Update translated strings in test_email_translation.
Updates the check email translation test for updated email text in
confirm_new_email.html and onboarding_zulip_topics.html for current
translated strings in German.
2024-03-27 11:16:59 -07:00
Sahil Batra 2c73590088 settings_components: Fix assert in get_input_element_value.
This commit fixes an assert statement in get_input_element_value
to also include the textarea elements, which is used for realm
description. After updating, the assert statement now checks
the input_elem to be having one of the following types -
HTMLInputElement, HTMLSelectElement and HTMLTextAreaElement,
as these cover all the possible input elements with input_type
set to "string".

Follow-up to #29264.
2024-03-27 08:29:04 -07:00
Alex Vandiver 80ef38757a puppet: Do not include postgresql_common for all PostgreSQL clients.
It pulls in the server.
2024-03-26 22:12:29 -07:00
nimishmedatwal 35c5231fe6 left-sidebar: Change recent conversation icon.
Fixes #29180
2024-03-26 12:55:34 -07:00
shashank-23002 246441bdcc tooltips: Hide scroll button tooltip under transition.
Fix a bug where scroll to bottom tooltip remains
visible even after the button dissapeared.
This was fixed in #29253 but the fix does not work
for the updated jquery event handling.
This updated fix bypasses the jquery wrapper to
access the exact propertyName.

Fixes: #28656
2024-03-26 12:53:33 -07:00
Alex Vandiver 64146b8704 kandra: Drop the munin port forward.
927660a7b6 removed the munin deploys; this stops tunneling port 4949
back to the nagios host.
2024-03-26 12:52:55 -07:00
Aman Agrawal 9515dd45ee right_sidebar: Show underline on user-toggle icon when sidebar visisble.
This syncs the behaviour of userlist-toggle button to always show an
underline when sidebar is visible.
2024-03-26 11:10:04 -07:00
Aman Agrawal cc54a7caa8 sidebar_ui: Allow user to hide right sidebar on any screen width. 2024-03-26 11:10:04 -07:00
Prakhar Pratyush 8d868ec149 send_message: Fix 'sent_by_this_client' incorrectly set.
Messages that are not delivered locally like slash command messages,
messages with backend only syntax, etc are processed by
'echo.process_from_server' function.

Earlier, in 'echo.process_from_server' we were clearing out
the local IDs of non-echoed messages and then a check to
set 'sent_by_this_client' based on local_id.

This led to 'sent_by_this_client' incorrectly set to False
as the local_id is already deleted.

This commit fixes the incorrect behavior. We first determine
the 'sent_by_this_client' on the basis of local_id and then
we delete.
2024-03-26 10:58:02 -07:00
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