Commit Graph

8937 Commits

Author SHA1 Message Date
Alex Vandiver
a0e5be7f2e register_remote_server: Be more explicit about example.com emails. 2025-10-06 22:20:01 -07:00
Alex Vandiver
fc42c70346 register_remote_server: Explain why we're validating the domain. 2025-10-06 22:20:01 -07:00
Tim Abbott
981fd35288 test_channel_creation: Fix misuse of test helper APIs.
This mix of authentication and endpoints used here was incoherent, and
throws an exception following the next commit.
2025-10-03 15:49:20 -07:00
Anders Kaseorg
890ccec8d4 timestamp: Use localized formatting in format_datetime_to_string.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-10-03 10:43:16 -07:00
Anders Kaseorg
b742ab18f9 emoji: Remove setting for deprecated Google blobs emoji set.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-10-01 13:35:06 -07:00
Aman Agrawal
024559e1b9 email_notifications: Convert datetime to local date string. 2025-10-01 11:25:00 -07:00
Alex Vandiver
755cb7d854 export: Move all queries, when possible, to iterators.
This reduces overall memory usage for large exports.
2025-10-01 11:21:34 -07:00
Alex Vandiver
cf33119348 export: Remove export-most-recent symlink.
The only callsite of do_export_realm calls `rmtree` on the output
path, which means this symlink is always dangling.  Since realms can
also be exported by end-users, following it would always be a race
condition, anyways.

Remove it.
2025-10-01 11:21:34 -07:00
Anders Kaseorg
c1a4dcf33d requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-30 16:47:54 -07:00
Anders Kaseorg
3ba68e7847 test_auth_backends: Fix _LDAPUser type errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-30 16:47:54 -07:00
Anders Kaseorg
f24a0a6b81 ruff: Fix RUF059 Unpacked variable is never used.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-30 16:47:54 -07:00
Shubham Padia
c3fbe00eb0 help: Add default page to display on /help when help server is off.
We've copied the button and error colors from portico_signin.css. We did
not want the new HTML file to depend on portico_signin.css since they
are unrelated. In addition, having those colors diverge over time might
not be an issue.

We make the raw mode work with /help and /help/ both.

See https://chat.zulip.org/#narrow/channel/19-documentation/topic/edits.20not.20appearing.20with.20vagrant/near/2257442

Co-authored-by: Alya Abbott <alya@zulip.com>
2025-09-26 11:41:10 -07:00
Alex Vandiver
3538455ca8 email_mirror: Drop missed-message emails which are autogenerated.
Emails to missed-message email addressees which are marked
"auto-replied" are clearly auto-replies, and will not contribute
usefully to the conversation.  We also ignore "auto-generated" emails
to missed-message addresses, as they must actually be auto-replies
which are misclassifying themselves, as missed-message addresses are
not meant to be targets for any auto-generated emails.

We accept auto-generated and auto-replied emails to stream incoming
email addresses, as auto-generated emails to those are clearly useful,
and auto-replied emails are unexpected enough to allow (given that
Zulip does not produce outgoing emails From: stream email addresses).
2025-09-26 09:18:13 -07:00
Sahil Batra
764f4aa2e0 groups: Use realm_for_sharding for limiting NamedUserGroup queries.
For get and filter queries of NamedUserGroup, realm_for_sharding
field is used instead of realm field, as directly using
realm_for_sharding field on NamedUserGroup makes the query faster
than using realm present on the base UserGroup table.
2025-09-23 12:15:53 -07:00
Sahil Batra
d4d7a8fe2a streams: Make sure that unused anonymous groups are not created.
Anonymous groups were being created for stream permission
settings when calling the subscriptions endpoint without
any streams data or when calling it only for subscribing
users to streams and not for creating any new streams.

This commit makes sure that no such unused anonymous groups
are created.
2025-09-23 12:15:51 -07:00
Sahil Batra
1e21f7b224 register: Rename stream_creator_or_nobody to channel_creator.
This commit renames `stream_creator_or_nobody` value for
`default_group_name` field in `server_supported_permission_settings`
object to `channel_creator`.
2025-09-23 12:12:23 -07:00
Shubham Padia
468a7a82dd help: Do not treat Help Center as a proper noun.
Fixes https://chat.zulip.org/#narrow/channel/101-design/topic/help.20center.20capitalization
2025-09-17 13:20:25 -07:00
Prakhar Pratyush
421637ce31 push_notifications: Skip enqueuing notif for users without push devices.
Previously, we enqueued events to "missedmessage_mobile_notifications"
even for users who had no registered push devices.
'handle_push_notification' later used to perform the check & skip
if there were no registered devices.

This commit avoids putting such events into the
"missedmessage_mobile_notifications" queue at all. By doing so,
we reduce unnecessary churn.
2025-09-17 12:32:49 -07:00
Anders Kaseorg
8a35871217 events: Remove realm_is_zephyr_mirror_realm from API.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-16 11:23:10 -07:00
Anders Kaseorg
40a022dcc3 zephyr: Remove Zephyr mirroring support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-16 11:18:18 -07:00
bedo
bc1ed82620 rate_limiter: Block IPv6 by /64 instead of per-single-IP.
Fixes #21544.

The network prefix (e.g. 64) identifies the network portion
which determines which bucket should that IPv6 belong to.

Implemented as a generic approach, so we have the option
to use different prefix sizes (leading to different buckets)
in the future.

Add comprehensive assertions for which IPv6s
are expected to belong to the same bucket and which are not.
2025-09-12 13:06:29 -07:00
Lauryn Menard
1030f41884 test-subs: Make new channel name consistent in notification bot test.
Updates final check in test_notification_bot_dm_on_subscription to
use the same pattern for the new channel name, and adds a comment
to clarify what that final check is for since it doesn't look at
the Notification Bot DM or channel messages for that case.
2025-09-08 16:52:37 -07:00
Lauryn Menard
14581de0de test-subs: Fix comment in test_notification_bot_dm_on_subscription. 2025-09-08 16:52:37 -07:00
Alex Vandiver
839135d007 users: Allow 1-character names.
Real people have 1-character names.  As seen by the previous attempt
to enforce length, in b7779667fc, real
people have names with all sorts of lengths.  All that we should care
about is that they're non-empty.
2025-09-08 14:30:59 -07:00
Anders Kaseorg
1a05b2c10f tabbed-instructions: Delete activate_correct_tab.
We no longer have any OS-specific tabs; we can just activate the first
one on the server side.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-04 09:37:34 -07:00
Mateusz Mandera
6ab30fcced import: Set Stream.subscriber_count for imported channels.
The import code wasn't setting subscriber_count at all, resulting in a
value of 0 when dealing with imports from 3rd party apps.
We run this unconditionally, also for imports from Zulip, since this
ensures we won't inherit incorrect values, if the data we're import has
them - e.g. due to some bugs that affected the server the data came from.
2025-08-29 11:58:17 -07:00
Karl Stolley
41e8d79e00 api_docs: Update get-file-temporary-url endpoint and add to sidebar.
Co-authored-by: Lauryn Menard <lauryn@zulip.com>
2025-08-29 10:21:42 -07:00
Prakhar Pratyush
f52533795b api_docs: Document /remotes/push/e2ee/register endpoint.
This commit documents the `/remotes/push/e2ee/register` endpoint.

We use auth_email="ZULIP_ORG_ID" and auth_api_key="ZULIP_ORG_KEY"
instead of "BOT_EMAIL_ADDRESS" and "BOT_API_KEY".
2025-08-28 11:46:09 -07:00
Prakhar Pratyush
062a736097 api_docs: Prep work to document zilencer endpoints.
Until now we were not documenting bouncer's REST API endpoints.

We plan to document the newly introduced "remotes/push/e2ee/register"
and "remotes/push/e2ee/notify" endpoints.

This commit does the prep work for documenting bouncer endpoints:
* mark the older endpoints related to sending non-E2EE push
  notifications as "intentionally_undocumented" - we'll remove
  them in future.
* the remaining endpoints are marked pending-to-document with
  helpful comments.
2025-08-28 11:46:09 -07:00
Prakhar Pratyush
9785cb4a09 render_curl_example: Remove unused 'auth_email' & 'auth_api_key'.
The 'function' variable in 'APICodeExamplesPreprocessor.generate_text'
matches the pattern of API_ENDPOINT_NAME = r"/[a-z_\-/-{}]+:[a-z]+"

It is always of the form 'endpoint_path:endpoint_method'.

There's no possibility of multiple ':'.

This commit removes the unused code block in `render_curl_example`,
which was trying to get 'auth_email' & 'auth_api_key' from 'function'.
2025-08-28 11:46:09 -07:00
Prakhar Pratyush
c604ecb902 push_notifications: Log roundtrip time since worker decided to send.
Adds a log for the end-to-end latency from when the worker decided
to send push notifications & received a success response from bouncer.

Fixes part of #35368.
2025-08-28 11:08:02 -07:00
Lauryn Menard
e5514d575d create-channel: Add test for invalid user ID in subscribers param. 2025-08-28 10:13:02 -07:00
Kislay Verma
9b7d6335c1 test_subs: Add send_new_subscription_messages parameter false test case.
For the sake of completion, we add a test case ensuring that
the response does not contain `new_subscription_messages_sent` if
the parameter `send_new_subscription_messages` is `false`,
as mentioned in the API documentation.
2025-08-27 17:06:31 -07:00
Kislay Verma
18d9b686b7 add_subscriptions: Only exclude DMs and not new channel notifications.
When the number of new subscriptions crosses a threshold, we wish to
avoid sending DMs to the user as implemented in #31206. But there was
a bug causing announcement channel and new channel notification
messages to also not be sent.

This commit fixes that bug by ensuring that we only exclude direct
message notications.
2025-08-27 17:06:31 -07:00
Kislay Verma
06d2ecb482 test_subs: Add test for all notification bot messages.
In #31206, we changed `add_subscriptions_backend` to exclude the
notification bot DMs when subscribing users to a channel when the
number of subscriptions exceeds MAX_BULK_NEW_SUBSCRIPTION_MESSAGES.

This caused a bug where new channel announcement and creation
notification messages were not being sent. Here we add a test that
confirmes the current behavior, which will be corrected in a
subsequent commit.

Co-authored-by: Lauryn Menard <lauryn@zulip.com>
2025-08-27 17:06:31 -07:00
Alex Vandiver
575dd10f99 reminders: Stop interpolating user-provided values in format string.
We must not intermix Markdown strings which are ready for the message,
with format strings which we intend to interpolate on.
2025-08-27 12:07:21 -07:00
Lauryn Menard
699c0c6200 create-channel: Remove send_new_subscription_messages parameter.
Removes send_new_subscription_messages parameter from
`POST channel/create` endpoint as Notification Bot DMs
are never sent when users are subscribed as part of
creating a new channel.

Not considered a documentable API change, since the previous parameter
never had any effect, so this is effectively just a documentation and
error-handling bug fix, not an API change relevant to implementors.
2025-08-27 11:12:05 -07:00
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
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
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
52671fd486 message_cache: Skip pickling JSON-encoded string in cache. 2025-08-27 09:22:56 -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
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
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
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
Sahil Batra
5675860707 channel-folders: Send event when reordering channel folders. 2025-08-12 11:17:17 -07:00