Commit Graph

20457 Commits

Author SHA1 Message Date
Lauryn Menard
8b1e536e6b create-channel: Rename send_messages_for_new_subscribers helper.
Because send_messages_for_new_subscribers also sends channel
notification messages about newly created channels, a clearer
name for is send_user_subscribed_and_new_channel_notifications.
2025-08-27 11:12:05 -07:00
Prakhar Pratyush
5a37942c61 push_notifications: Parse push/e2ee/notify response using Pydantic.
In `send_push_notifications`, we were manually asserting types of the
fields returned by the `remotes/push/e2ee/notify` endpoint at runtime
and constructed the `response_data` data structure for further use.

Pydantic is the perfect tool for this task.

This commit updates the concerned code to use Pydantic's `TypeAdapter`.

No functional change.

Fixes part of #35368.
2025-08-27 10:58:10 -07:00
Prakhar Pratyush
3548764e21 push_notifications: Use SentPushNotificationResult dataclass.
Refactoring, no functional change.

This commit refactors `send_e2ee_push_notification_apple`
and `send_e2ee_push_notification_android` to return a
`SentPushNotificationResult` dataclass.

It's a cleaner protocol than passing a mutable data structure
`delete_device_ids` as argument and updating it within
functions.

Fixes part of #35368.
2025-08-27 10:56:42 -07:00
Alex Vandiver
d15f2fb831 export-search: Use background workers to download attachments. 2025-08-27 10:24:21 -07:00
Alex Vandiver
7714ca3ff9 export-search: Add explicit usermessage message_id range filters. 2025-08-27 10:24:21 -07:00
Alex Vandiver
b9216c768d export-search: Use chunked regions by id range. 2025-08-27 10:24:21 -07:00
Alex Vandiver
e703f65198 export-search: Joins to usermessages may require adding a distinct. 2025-08-27 10:24:21 -07:00
Alex Vandiver
e9c6856d02 export-search: Limit to only the fields we need. 2025-08-27 10:24:21 -07:00
Alex Vandiver
ae090d9ff3 export-search: Prefetch message sender.
This avoids O(n) extra queries.
2025-08-27 10:24:21 -07:00
Alex Vandiver
c68be03df7 markdown: Remove vestigial Twitter code and cache.
Contrary to what the comment implied, the remaining `fetch_tweet_data`
function would never return a cache hit, as it is namespaced by the
current deploy's cache key.
2025-08-27 09:22:56 -07:00
Alex Vandiver
9715f6c104 cache: Use zstd compression level 9 for bmemcached compression. 2025-08-27 09:22:56 -07:00
Alex Vandiver
33e6d78f3b memcached: Switch to zstd compression.
This cannot go in `CACHES` because a module cannot be serialized via
pickle.
2025-08-27 09:22:56 -07:00
Alex Vandiver
52671fd486 message_cache: Skip pickling JSON-encoded string in cache. 2025-08-27 09:22:56 -07:00
Alex Vandiver
7f325108a3 message_cache: bmemcache already applies compression.
This will appear to _increase_ time spent in memcached, according to
our access logs.  This is because we used to apply zlib compression
twice -- once, outside of our performance logging, and a
second (ineffectual) time inside.  We now only compress once, which
reduces the overall time, and accounts for it more correctly.
2025-08-27 09:22:56 -07:00
Alex Vandiver
9c92fe8f34 streams: Skip pickling the recipient string in cache. 2025-08-27 09:22:56 -07:00
Alex Vandiver
0d6cfc2a63 cache: Add pickled_tupled=False to allow skipping pickling for str/bytes. 2025-08-27 09:22:56 -07:00
Mateusz Mandera
5ef6852cfe delete_in_topic: Don't unnecessarily fetch .recipient.
This reverts commit f119c33789.
With 51cef01c29 merged, there is no need
to fetch .recipient here, as it won't be accessed by the delete messages
codepath.
2025-08-27 09:08:00 -07:00
Mateusz Mandera
51cef01c29 message: Use .is_channel_message column instead of is_stream_message().
This avoids a potential unnecessary message.recipient fetch required by
is_stream_message(). is_stream_message() methods precedes the addition
of the denormalized is_channel_message column and is now unnecessary.

In practice, we usually fetch Message objects with `.recipient` already,
so I don't expect any notable performance impact here - but it's still a
useful change to make.
2025-08-19 23:37:07 -07:00
Mateusz Mandera
4e3ec77a0f retention: Eliminate join with Recipient table when archiving DMs.
We can use the is_channel_message column instead of doing the join to
filter on recipient type.
2025-08-19 23:36:10 -07:00
Lauryn Menard
6847c5bfdb api-docs: Revise "description" parameter of new channel folder.
This parameter should be marked as required, but allowing an empty
string value. Updates the description of the parameter to be more
explicit of that fact.
2025-08-14 16:51:35 -07:00
Lauryn Menard
a497571be6 api-docs: Use a more realistic example for a new channel folder ID. 2025-08-14 16:51:35 -07:00
Lauryn Menard
1d99e55bb4 api-docs: Revise descriptive text in channel folders endpoints.
Adds links to relevant help center documentation on channel
folders.
2025-08-14 16:51:35 -07:00
Lauryn Menard
4f4923ef2b channel-folders: Create two channel folders in the dev database.
Adds a visible example to the PATCH /channel_folders endpoint for
reordering an organization's channel folders. So that the example
works in a normal dev environment, we also add a second channel
folder when populating the dev database.
2025-08-14 16:51:35 -07:00
Lauryn Menard
451e64b3e6 api-docs: Mark "name" required for new channel folder.
Also, note that an empty string for the "name" parameter, when
creating or updating a channel folder, is not a valid value.
2025-08-14 16:51:35 -07:00
Lauryn Menard
4b0a9e484a api-docs: Mark "order" as required for reodering channel folders. 2025-08-14 16:51:35 -07:00
Lauryn Menard
4b7e0be1ab api-docs: Add admin only notes for channel folder endpoints. 2025-08-14 16:51:35 -07:00
Alex Vandiver
331d210dac push_notifications: Revert parallel-device sending.
This reverts #26594, due to unexpected ConnectionClosed errors observed in Django.
2025-08-14 07:36:20 -07:00
Tim Abbott
25319590d0 api_docs: Fix missing changes entry for status endpoint.
715d07c231 was missing an API feature
level change.
2025-08-13 16:07:27 -07:00
Tim Abbott
9b2e270a49 zulip_updates: Add an update for the 11.0 release. 2025-08-13 14:48:11 -07:00
Anders Kaseorg
2ddafe728e thumbnail: Avoid BytesIO.getbuffer.
It seems to cause ‘BufferError: Existing exports of data: object
cannot be re-sized’ on Python 3.13.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2025-08-13 14:11:05 -07:00
Anders Kaseorg
f9faad0997 test_timezone: Ignore legacy MET, MEST aliases.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2025-08-13 14:11:05 -07:00
Anders Kaseorg
e216317f88 test_mattermost_importer: Condition html2text crash on Python version.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2025-08-13 14:11:05 -07:00
Tim Abbott
3e84eaab5d onboarding: Improve welcome bot custom message wrapper.
The previous text was rather wordy, and using a silent mention makes
it clear who has the ability to control this group, and who one can
potentially contact with questions.
2025-08-13 14:09:20 -07:00
Alex Vandiver
04fe9be715 upload: Serve 0-byte files locally, not from S3. 2025-08-13 14:07:21 -07:00
Alex Vandiver
7480510aeb embeds: Propagate group membership before updating UserMessage flags. 2025-08-13 10:38:40 -07:00
Prakhar Pratyush
3cbf0e70a2 push_notification: Add support to send E2EE test push notification.
This commit adds an endpoint `/mobile_push/e2ee/test_notification`
to send an end-to-end encrypted test push notification to the user's
selected mobile device or all of their mobile devices.
2025-08-13 00:13:50 -07:00
Prakhar Pratyush
f034a6c3b4 push_notification: Remove is_removal param from send_push_notifications.
We can determine whether the request is meant to revoke an already
sent push notification using the "type" field of the payload.

Passing `is_removal` parameter explicitly to `send_push_notifications`
is not required.
2025-08-13 00:13:50 -07:00
Alya Abbott
a05c76fba3 updates: Edit update announcement (level=20).
Describe additional features; the prior version has not been
deployed to Cloud.
2025-08-12 17:25:42 -07:00
opmkumar
aa9aa2160b help: Clean up search by location documentation. 2025-08-12 15:26:12 -07:00
Vector73
f1d1d5f1a4 events: Add support for sending presence events in modern format.
If the client has passed `simplified_presence_events` as true
in the `client_capabilities` parameter of the `POST /register`
request, then the server will send `presence` events with the
`presences` field, which has the user presence data in the
modern API format. When that client capability is false, the
`presence` event will be unchanged and sent with the user
presence data in the legacy format.
2025-08-12 12:37:54 -07:00
Vector73
88761f70a2 event_schema: Rename "presence" event to "legacy_presence". 2025-08-12 12:14:56 -07:00
Mateusz Mandera
58427f8ed1 external_auth_id: Add new unique constraint. 2025-08-12 12:10:45 -07:00
Sahil Batra
5675860707 channel-folders: Send event when reordering channel folders. 2025-08-12 11:17:17 -07:00
Sahil Batra
bcdfcf909d welcome-bot: Only send message with custom text when testing.
We now only send the custom message when using
"Send me a test message" button and not send the
standard welcome bot message.
2025-08-12 00:12:52 -07:00
apoorvapendse
8f14b717ff zerver: Drop support for Zulip API emails in channel creation.
Also write the description a bit better.

Discussion:
https://chat.zulip.org/#narrow/channel/378-api-design/topic/Channel.20creation.20should.20return.20the.20channel.20ID/near/2240040.

Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-08-11 23:40:12 -07:00
Prakhar Pratyush
870591e2e5 test_urls: Skip api_docs/unmerged.d/ while testing api doc pages.
We missed to skip `api_docs/unmerged.d/` in 9ec15e99bd,
resulting in test failure in pull requests where it is present.
2025-08-11 14:37:31 -07:00
Mateusz Mandera
f119c33789 delete_in_topic: Don't fetch .recipient for each message in a loop.
The grouping logic in `do_delete_messages` calls
`message.is_stream_message()` in a loop, which needs to access
message.recipient. This is obviously super inefficient if .recipient
hasn't been prefetched for the message objects.

`delete_in_topic` is the only function that calls `do_delete_messages`
with many messages, so this is the only spot we need to fix, to address
the immediate bug.
Of course a better improvement would be to fix `do_delete_messages` to
do something smarter than naively accessing message.recipient in a loop.
2025-08-11 10:08:40 -07:00
apoorvapendse
6203861529 zerver: API to create channel.
Fixes #16206.

Co-authored-by: Sahil Batra <sahil@zulip.com>
Co-authored-by: Steve Howell <showell@zulip.com>
Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-08-08 19:29:17 -07:00
Tim Abbott
6ef2591b47 test_invite: Fix a test failing with old databases. 2025-08-08 18:59:37 -07:00
Saubhagya Patel
bb5c87e306 bots: Add a setting to customize the Welcome Bot message.
This commit includes the following changes:
- Add an administrator setting to customize the Welcome Bot
message when sending an invitation.
- Add an API endpoint to test the customized Welcome Bot message
by sending a copy of the message to the administrator.

Fixes #27663.

Co-authored-by: Akarsh Jain <akarsh.jain.790@gmail.com>
2025-08-08 18:59:37 -07:00