Commit Graph

5850 Commits

Author SHA1 Message Date
Alex Vandiver
c5200e8b05 deliver_scheduled_emails: Use a queue, instead of infinite retries.
`deliver_scheduled_emails` tries to deliver the email synchronously,
and if it fails, it retries after 10 seconds.  Since it does not track
retries, and always tries the earliest-scheduled-but-due message
first, the worker will not make forward progress if there is a
persistent failure with that message, and will retry indefinitely.
This can result in excessive network or email delivery charges from
the remote SMTP server.

Switch to delivering emails via a new queue worker.  The
`deliver_scheduled_emails` job now serves only to pull deferred jobs
out of the table once they are due, insert them into RabbitMQ, and
then delete them.  This limits the potential for head-of-queue
failures to failures inserting into RabbitMQ, which is more reasonable
than failures speaking to a complex external system we do not control.
Retries and any connections to the SMTP server are left to the
RabbitMQ consumer.

We build a new RabbitMQ queue, rather than use the existing
`email_senders` queue, because that queue is expected to be reasonably
low-latency, for things like missed message notifications.  The
`send_future_email` codepath which inserts into ScheduledEmails is
also (ab)used to digest emails, which are extremely bursty in their
frequency -- and a large burst could significantly delay emails behind
it in the queue.

The new queue is explicitly only for messages which were not initiated
by user actions (e.g., invitation reminders, digests, new account
follow-ups) which are thus not latency-sensitive.

Fixes: #32463.
2025-03-04 16:09:25 -08:00
Shubham Padia
0def74b097 message: Make is_modifying_message a mandatory kwarg.
This is valuable so that one is forced to explicitly make a decision
on what is correct when adding new callers. Past experience tells us that
not having to explicitly show the decision leads to people introducing
security bugs in PRs that the maintainer has to catch in review, and our
goal for access control code should be that security bugs are hard to write.
Fixes #33688.
2025-02-28 10:10:33 -08:00
Anders Kaseorg
3af4900891 install-node: Upgrade Node.js from 22.12.0 to 22.14.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-26 16:20:47 -08:00
apoorvapendse
8b9ba36465 copy_and_paste: Split copy and paste.
Note that the puppeteer tests only tested
copying whereas the node tests only tested
pasting, which is why the puppeteer tests
for pasting and node tests for copying are
absent after this split.
2025-02-26 13:15:50 -08:00
Sahil Batra
d29ac45b99 streams: Remove unused code for can_add_subscribers_group label.
Text shown in parentheses with label for can_add_subscribers_group
was removed in befe49c293.
2025-02-25 13:17:15 -08:00
Sahil Batra
166d9282b8 streams: Use can_subscribe_group setting for checking permission.
This commit adds code to use can_subscribe_group setting in webapp.

Fixes part of #33417.
2025-02-25 13:17:15 -08:00
Anders Kaseorg
d7556b4060 requirements: Migrate to uv.
https://docs.astral.sh/uv/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-24 22:29:24 -08:00
Anders Kaseorg
72f5df2e09 install: Remove --cacert and CUSTOM_CA_CERTIFICATES.
This has been broken for many years and nobody’s complained.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-24 22:29:24 -08:00
Apoorva Pendse
979b4203c7 compose_banner: Reword no channel selected banner error.
Preparatory commit for #32115.
2025-02-23 23:11:18 -08:00
Alex Vandiver
c84c76f3a1 puppet: Upgrade external dependencies. 2025-02-21 14:38:31 -08:00
Vector73
e9d31d63a7 tools: Add tools to manage API feature level changes.
This commit adds two new tools to avoid API feature level rebases:

`create-api-changelog`: Generates an empty changelog file for temporarily
recording API changes.

`merge-api-changelogs`: Merges temporary changelog files and increments
the API feature level.
2025-02-19 17:16:10 -08:00
opmkumar
1e99745023 todo_list: Add option for modal to create todo-lists.
A button has been introduced to launch a modal
for creating todo-lists directly from the compose box.

The modal features a form that, upon submission,
generates a message using the `/todo` syntax and the data
inputted in the form. Subsequently, the content of the compose box
is set to this message, which the user can then send.

This modal closely parallels the UI for adding a poll; therefore,
the poll and todo code has been shifted to a newly created
file named `widget_modal.ts`, and `poll_modal.ts` is now deprecated.

Co-authored-by: Sujal Shah <sujalshah28092004@gmail.com>

Fixes #29779.
2025-02-14 14:57:24 -08:00
Alex Vandiver
a7d513e5ec users: Remove unnecessary get_api_key helper.
Using the column name is clearer.
2025-02-13 12:40:53 -08:00
opmkumar
2a15da47d9 message_edit: Show typing indicator for message editing.
This commit adds typing indicators for message editing in stream
as well as in dm, if the send typing notification
for corresponding is enabled.

Based on earlier work in #28585.

Co-authored-by: Rohan Gudimetla <rohan.gudimetla07@gmail.com>

Fixes #25719.
2025-02-12 15:08:56 -08:00
Aman Agrawal
2f5aea6604 message_summary: Add setting to put a monthly rate limit per user. 2025-02-06 12:03:24 -08:00
Pratik Chanda
1545a75645 tooltips: Refactor left sidebar tooltips to its own module.
This commit refactors tooltip targeting left sidebar elements
into its separate module in `left_sidebar_tooltips`.
2025-02-05 13:21:54 -08:00
Tim Abbott
bd08c0b980 docs: Explain web app translations before server, and use those terms.
This seems good for prioritizing what is important first, and should
make it easier to add the Flutter app in the future.
2025-01-31 14:32:47 -08:00
Sayam Samal
028e9dc58a banners: Redesign desktop notifications navbar banner.
As part of the banner redesign project, this commit applies the new
banner styles to the desktop notifications navbar banner.

This commit also acts as a base for the following banner redesign
commits by defining the `banners.ts` module, which now acts as the
centralized module to handle the banner rendering and sets up the
common event listeners.
2025-01-30 10:17:39 -08:00
Maneesh Shukla
e33fe6779b user_group: Rename invite_user_group_picker_pill.ts to user_group_picker_pill.ts.
Fixes part of #32488.
2025-01-28 15:13:19 -08:00
Aman Agrawal
548afc2f1a topic_summary: Add button to generate narrow summary.
This remains only enabled in the development environment.
2025-01-28 13:13:20 -08:00
Aman Agrawal
dc9422ec81 test_message_summary: Add a basic test. 2025-01-27 12:23:40 -08:00
Anders Kaseorg
0ba41328fd openapi: Fix misuse of nullable as sibling of oneOf.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-24 23:00:21 -08:00
Shubham Padia
2fdb4fe53c stream: Add conditional note to can_add_subscribers_group.
Fixes #33156.
If the stream is set to on the private settings for privacy, we add a
parenthesis text `must be subscribed`.
We had to use JS to change the string since just having a conditional in
the handlebars template would not ensure that the parenthesis text
appears or disappears on changing the value.
2025-01-23 15:57:16 -08:00
Shubham Padia
82c04ebe9e stream_types: Add admin permissions note below advanced configurations.
We've also removed the label_parens_text of `in addition to organization
administrators` wherever applicable.
2025-01-23 15:57:16 -08:00
Aman Agrawal
b047c4d322 message_summary: Add API endpoint to generate narrow summary.
This prototype API is disabled in production through settings not
configuring a default model.
2025-01-22 12:12:08 -08:00
Karl Stolley
cf29edaa65 compose: Flatten a popover-free formatting bar. 2025-01-14 15:52:02 -08:00
Anders Kaseorg
f223251ffe requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-14 09:42:16 -08:00
Anders Kaseorg
653b0b0436 ruff: Partially reformat Python with Ruff 0.9 (2025 style).
These are the changes that are backwards compatible with the 2024
style.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-14 09:42:16 -08:00
Prakhar Pratyush
e9553daee4 topic-list-item: Show realm_empty_topic_display_name for topic="".
This commit adds support to display `realm_empty_topic_display_name`
value in the left sidebar for topics having the actual value of
empty string.
2025-01-10 14:32:55 -08:00
Sayam Samal
6557cd74cd stream_color: Replace spectrum color picker with native color picker.
This commit replaces the spectrum color picker used in the stream
popover and stream settings with a custom color picker popover, which
contains a grid of predefined color swatches and a custom color option.

The custom color option uses the HTML5 <input type="color"> which shows
the native browser color picker UI.

Fixes #14961.
2025-01-07 17:27:23 -08:00
Prakhar Pratyush
5d9beb3655 fetch_messages: Add support for empty topic names.
This commit is a part of the work to support empty string
as a topic name.

Previously, empty string was not a valid topic name.

Adds `allow_empty_topic_name` boolean parameter to `GET /messages`
and `GET /messages/{message_id}` endpoints to decide whether the
topic names in the fetched messages can be empty strings.

If False, the topic names in the fetched message will have the
value of `realm_empty_topic_display_name` field in `POST /register`
response replacing "" for channel messages.
2025-01-07 17:24:00 -08:00
Prakhar Pratyush
3ba198e79a message_send: Add support to send message with an empty topic name.
This commit is a part of the work to support empty string
as a topic name.

Previously, empty string was not a valid topic name.

Adds a `empty_topic_name` client capability to allow client
to specify whether it supports empty string as a topic name.

Adds backward compatibility for:
- `subject` field in the `message` event type
2025-01-07 17:24:00 -08:00
Prakhar Pratyush
31b3842c9b delete_topic: Delete UserTopic rows when a topic is deleted.
Earlier, when a topic was deleted then UserTopic rows corresponding
to that topic were not deleted resulting in a bug where the topic
is listed in the '/#settings/topics' panel even after deletion.

This commit fixes the incorrect behavior to delete the concerned
UserTopic rows.

We need to take special care of the case when a topic is deleted
in private channel with protected history. We delete the UserTopic
records for exactly the users for whom after the topic deletion
action, they no longer have access to any messages in the topic.
2025-01-07 16:41:02 -08:00
Sahil Batra
2d09cd899e message: Use new setting for checking stream posting permissions. 2025-01-07 12:17:09 -08:00
Steve Howell
f9b7def098 custom lint checks: Avoid direct calls to rewire setters. 2025-01-07 09:43:33 -08:00
Steve Howell
6a4102f9fa lint: Add cjs suffixes to JS checks. 2025-01-07 09:43:33 -08:00
apoorvapendse
8cc4b655ba code_block: Exclude 🔥 emoji alias for mojo. 2025-01-03 15:16:32 -08:00
Anders Kaseorg
89bc073b5b emoji_names: Rebuild with CLDR 46.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-02 17:30:40 -08:00
Anders Kaseorg
a9d64d5604 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-02 17:30:40 -08:00
Anders Kaseorg
7ce49a709e check-schemas: Remove unnecessary special case for saved_snippets.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-01-02 17:28:17 -08:00
Steve Howell
5fd24bc9a2 event checkers: Replace data_types.py with pydantic.
This commit completely eliminates the home-grown
data_types.py system for checking types.

Now, in our unit tests and schema checkers, we use
pydantic types to check the shape of the event
objects that are either in our JSON fixtures or
that get captured by test_events.py.

The code in event_types.py was completely
code-generated from the legacy version of
event_schema.py, so there shouldn't be any
manual errors in how I ported the types over.
(The code generation was non-trivial, though,
as I had to account for changes from
snake_case to CamelCase and deal with some
other anomalies.)
2025-01-02 12:23:35 -08:00
Steve Howell
934f584257 check-schemas: Improve success output.
We now tell you how many fixtures were checked
as part of the success message.

Right now we're up to 118 checks.
2025-01-02 12:23:35 -08:00
Steve Howell
01f4ec5ee4 check-schemas: Enforce that all fixtures get checked.
I had to work around that the event type is "saved_snippets",
but the author of the feature otherwise correctly used
the singular "saved_snippet".
2025-01-02 12:23:35 -08:00
Steve Howell
7480c5f285 checks-schemas: Remove checks related to API docs.
When we move away from `data_types.py` in favor of using
`pydantic` to describe the shape of our event objects in
the events test (hopefully coming soon), then the code
I deleted here will no longer work.

The consequence of this change is that API docs may
diverge from the actual event types that we use, but
I believe there are better ways to manage this.

Also, the deleted code was particularly hard to debug
(and I say that as the original author). It probably
also causes friction for folks who want to update the
docs but who don't necessarily grok how the event tests
work under the legacy `data_types.py` regime.

Once we get pydantic types working, we can probably
just write a separate tool to validate against them
against the API docs using the `openapi-schema-pydantic`
package or something similar.
2025-01-02 12:23:35 -08:00
apoorvapendse
5378464f87 provision: Source virtualenv for login shells conditionally.
This commit conditionally adds the source command for
virtualenv in the user's bash profile only when the
system is virtualized.

Checking WSL_DISTRO_NAME in the env vars
is the cheapest option in case of checking
whether the system runs as WSL VM since
it is an in memory operation.
Hence it is checked for first in `is_wsl_instace`.

Fixes #15029.
2025-01-02 09:11:43 -08:00
Anders Kaseorg
6dfa1b6138 types: Extract update_message_event_schema.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-30 09:42:26 -08:00
Anders Kaseorg
2548430af3 types: Extract and correct user_group_update_event_schema.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-30 09:42:26 -08:00
Anders Kaseorg
19b8cde27f ruff: Fix PLC0206 Extracting value from dictionary without calling .items().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-21 21:06:53 -08:00
Harsh Bansal
4d3cc2c5a5 portico: Improve layout of /go page.
Made the input field of the page consistent with
the other similar pages. Here are I have done the following things:
1. Changed text 'Enter your organization's Zulip URL:'->'Organization URL'.
2. Left aligned the label and button to make it consistent.
3. Moved 'Don't know your organization URL? Find your organization.' to be
just below the URL field.
4. Changed the placeholder 'your-organization-url' -> 'your-organization'

Fixes #32198
2024-12-17 23:24:00 -08:00
Sahil Batra
4cb9fb0d5a group-permission-settings: Add function to get list of setting names.
This commit adds a function which returns type checked list of
group permission setting names so that all the type checking
has to be done only once.
2024-12-17 12:36:23 -08:00