Commit Graph

20199 Commits

Author SHA1 Message Date
Alex Vandiver
4c2cf4dca8 compilemessages: Weblate's Language-Team uses <>. 2025-07-18 04:33:52 +00:00
Tim Abbott
d465705177 api: Document meaning for twenty_four_hour_time=null.
This documentation-only change will allow us to add that as a valid
value in the future, by having client implementations not crash on
seeing the value.

See [the API design discussion](https://chat.zulip.org/#narrow/channel/378-api-design/topic/.60user_settings.2Etwenty_four_hour_time.60/near/2220575).
2025-07-17 17:45:49 -07:00
Tim Abbott
fe8853bcc9 api: Increment API feature level to 407. 2025-07-17 15:45:17 -07:00
Vector73
9e63cd57fe tests: Add tests for deleting private messages. 2025-07-17 15:44:53 -07:00
Vector73
a02614204a settings: Add can_set_delete_message_policy_group setting.
Adds new organization setting `can_set_delete_message_policy_group`
for defining who can set per-channel message delete permissions.

Fixes #34214.
2025-07-17 15:44:53 -07:00
Vector73
97a43fa6b6 stream_settings: Add can_delete_own_message_group setting.
Adds per-channel `can_delete_own_message_group` setting for
defining who can delete their own message in the channel.
2025-07-17 15:44:52 -07:00
Vector73
c4e641365b stream_settings: Add can_delete_any_message_group setting.
Adds per-channel can_delete_any_message_group setting for
defining who can delete any message in the channel.
2025-07-17 15:44:42 -07:00
Anders Kaseorg
d24eab02d2 request: Use Django 5.2 HttpRequest.get_preferred_type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-17 14:37:11 -07:00
Anders Kaseorg
6006ba4c44 upload: Make closest_thumbnail_format take an HttpRequest.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-17 14:37:11 -07:00
Alex Vandiver
d1995687c9 i18n: Remove mobile.json-related codepaths. 2025-07-16 19:59:20 -07:00
Alex Vandiver
7da05b3f7d tests: Rename gcm_devices to fcm_devices.
We only use GCM in the code when strictly necessary.
2025-07-16 16:59:58 -07:00
Alex Vandiver
5d585eff37 tests: Remove unnecessary tuples. 2025-07-16 16:59:58 -07:00
Alex Vandiver
3e5af466e4 push_notifications: Remove vestiges of base64 storage of tokens.
APNs tokens are provided by the client in hex, and we store them in
hex.  The existing code which attempts to "validate" them by parsing
them as base64 only works because base64 is a superset of hex.

Enforce that APNs tokens are hex, and remove all of the pieces of test
code which were incorrectly passing them in as base64 strings.
2025-07-16 16:59:58 -07:00
PieterCK
9de1b47ffa slack_import: Improve topic name for Slack threads.
This updates the topic name format for Slack threads to include a
snippet of the original message. Currently the format looks like this;
"{date} Slack thread {n}", which provides little to no context about the
thread.

Currently we also use the `thread_ts_str` key to keep track of Slack
threads we're converting, this key format makes it so that it has a
small chance of combining threads with the same timestamp under one
topic. This commit updates it to use a new key format, `thread_key`.

Fixes #27661.
2025-07-16 14:32:05 -07:00
Mateusz Mandera
4210ccc5db realm_reactivation: Use redirect-to-POST trick.
Uses the approach done for email change confirmations in #34980 to avoid
triggering a reactivation via just a GET request. Instead, the GET
should return a page which will trigger the browser to then POST the key
to the endpoint.
2025-07-16 13:53:20 -07:00
Tim Abbott
5b00cb6753 Partially revert "home: Enable partial_subscribers in web app."
This reverts commit 458c660f65.

We realized we need one more pull request before we can turn this on.
I kept the hunks related to finalizing the cutoffs.
2025-07-16 13:26:33 -07:00
Tim Abbott
458c660f65 home: Enable partial_subscribers in web app.
Fixed #34244.
2025-07-16 13:11:56 -07:00
Apoorva Pendse
6166576059 api_docs: Link to message-formatting article where relevant.
Fixes: https://chat.zulip.org/#narrow/channel/412-api-documentation/topic/document.20html.20for.20markdown/near/2216238.
Signed-off-by: Apoorva Pendse <apoorvavpendse@gmail.com>
2025-07-16 09:39:41 -07:00
apoorvapendse
ebbb208a47 streams: Extract channel description validation logic.
Fixes: Point 1 of https://github.com/zulip/zulip/pull/33405#issuecomment-3064452310
Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-07-16 09:38:36 -07:00
apoorvapendse
947658def4 streams: Extract topics_policy validation.
Fixes: Point 3 of
https://github.com/zulip/zulip/pull/33405#issuecomment-3064452310.
Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-07-16 09:38:36 -07:00
akshatdalton
520c58bf6b narrow: Fix topic highlighting issue with apostrophes in search results.
This commit addresses the issue where the topic highlighting
in search results was offset by one character when an
apostrophe was present. The problem stemmed from the disparity
in HTML escaping generated by the function `func.escape_html` which
is used to obtain `topic_matches` differs from the escaping performed
by the function `django.utils.html.escape` for apostrophes (').

func.escape_html | django.utils.html.escape
-----------------+--------------------------
      &#39;      |           &#x27;

To fix this SQL query is changed to return the HTML-escaped
topic name generated by the function `func.escape_html`.

Fixes: #25633.

Co-authored-by: Pieter CK <pieterceka123@gmail.com>
2025-07-16 09:26:40 -07:00
Alex Vandiver
c977730f81 mime_types: Remove incorrect comment, and add audio/mp4 and audio/webm.
The comment came from when the only use of `AUDIO_INLINE_MIME_TYPES`
was based on the result of `mimetypes.guess_type`, which would happen
to always return `video/mp4` and not of `audio/mp4` for `.mp4` files.
Before being merged, the code was updated to examine uploaded files'
content-type, which can very well be `audio/mp4` -- and in such cases,
should very much be shown inline.

Add the missing content-types to `AUDIO_INLINE_MIME_TYPES`, and remove
the comment.
2025-07-16 09:20:31 -07:00
Sahil Batra
70d18d7528 tests: Move test for permission to update topics_policy.
This commit updates tests for permission to update topics_policy
of a channel to test_channel_permissions.py.
2025-07-15 15:54:30 -07:00
Sahil Batra
7e6d487916 tests: Improve tests for checking permissions to update channel privacy.
This commit updates check_channel_privacy_update to use
do_change_stream_permission for setting the stream privacy
to its old state so that we do that in a reliable way and
can avoid bugs in future.
2025-07-15 15:54:30 -07:00
Sahil Batra
2126f365c0 tests: Refactor test for checking permission to update channel.
This commit updates how we check permission for updating
properties of an unsubscribed private channel.

There is no need of checking all can_administer_channel_group
values for unsubscribed private channel, when we check them
for a subscribed private channel. It is sufficient to check
one case where an unsubscribed user can update private channel
if they belong to can_administer_channel_group.

This also helps in avoiding repeated calls to subscribed_to_stream
which made a DB query that could make the test slow.
2025-07-15 15:54:30 -07:00
Sahil Batra
534fdc2ac1 test_channel_permissions: Use one parameter for error cases.
This commit updates check_channel_property_update to just
accept error_msg parameter instead of having both allow_fail
and error_msg, as error_msg is sufficient to determine
whether the request is expected to fail or not.
2025-07-15 15:54:30 -07:00
PieterCK
580845415b slack_data_import: Refactor get_user_mentions.
This commit extracts a portion of logic from `get_user_mentions` into a
new helper function for reusability. This is a prep commit for #30166.
2025-07-15 15:49:05 -07:00
Alex Vandiver
a5a5791794 management: Skip hourly crons during deploys.
This is most important for `send_zulip_update_announcements`, which
can race with the version run as a post-deploy hook.  However, all of
these crons can tolerate being slightly delayed, and there's little
benefit to them taking CPU or possibly hitting odd borderline race
conditions when the deploy is in progress.

For safety, we only trust the deploy lockfile if it was created
within the last hour -- deploys should not take more than an hour, and
failing to ever run hourly crons is much worse than perhaps running
them during a real very-long deploy.
2025-07-15 09:07:36 -07:00
Prakhar Pratyush
7d6b18976a api-docs: Fix link formatting and improve status value presentation.
Corrected a broken Markdown link.

Also updated the description of the `status` field to use backticks
with values.
2025-07-15 07:33:16 -07:00
Anders Kaseorg
b1a7db3662 forms: Use monkey-patched SetPasswordForm generic.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-15 07:32:44 -07:00
Anders Kaseorg
3be686fa86 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-15 07:32:44 -07:00
Tim Abbott
bd29fb3e26 push_registration: Fix incorrect line-wrapping. 2025-07-14 15:12:30 -07:00
Mateusz Mandera
374c1a93ee realm_audit_logs: Add clarifying comment to REALM_IMPORTED event. 2025-07-14 15:11:43 -07:00
Mateusz Mandera
35ed45ce44 import: Send Welcome Bot messages to users from non-Zulip exports.
Exports from other apps obviously don't come with Welcome Bot messages -
which isn't a great experience as it is, as those are meant to help with
onboarding. We should generate them for all users at import time.

We limit the set of users to active accounts to make the workload more
reasonable in case of large orgs with plenty of deactivated accounts.
The downside is that an imported user joining after being reactivated
will be lacking these messages. We can re-think this approach if needed.

Fixes #34820.
2025-07-14 15:11:43 -07:00
Mateusz Mandera
a43bdcd166 import: Fix is_realm_imported_from_other_zulip_server logic.
This logic was fundamentally broken:
```
    is_realm_imported_from_other_zulip_server = RealmAuditLog.objects.filter(
        realm=realm, event_type=AuditLogEventType.REALM_EXPORTED
    ).exists()
    if not is_realm_imported_from_other_zulip_server:
        send_zulip_update_announcements_to_realm(
            realm, skip_delay=False, realm_imported_from_other_product=True
        )
```

Because the `REALM_EXPORTED` was only created after the export completed
- meaning it couldn't be included in the export data at all. Thus
considering exports to be "not from Zulip" incorrectly.

We get around this issue by explicitly including an import_source in the
realm dict in the export data from 3rd party apps. The importer can then
rely on this value to determine if it's dealing with a Zulip-originated
export or not.
2025-07-14 15:11:43 -07:00
Mateusz Mandera
1c5c2b79ca import: Fix import of RealmAuditLogs with modified_channel_folder.
RealmAuditLog objects with `modified_channel_folder` set would crash the
import because we were missing the `re_map_foreign_keys` call for the
field.
2025-07-14 15:11:43 -07:00
Prakhar Pratyush
5f8edf669d zerver: Add endpoint to register a push device to server.
This commit adds an endpoint to register a push device
to receive E2EE push notifications.
2025-07-14 14:52:39 -07:00
Prakhar Pratyush
c846302417 send_to_push_bouncer: Avoid repeated code lookup in error handling.
This commit extracts `code` lookup into a local variable
to simplify and de-duplicate the conditional logic for
handling different error codes.
2025-07-14 14:52:38 -07:00
Prakhar Pratyush
afe6986991 register-queue: Add push_devices in response.
This commit adds a `push_devices` dictionary to
`POST /register` response, keyed with push account ID,
where each entry describes the user's push device's
registration status and error code (if registration failed).
2025-07-14 14:52:38 -07:00
Prakhar Pratyush
6a4b06b6f4 zerver: Add PushDevice model.
This commit adds a `PushDevice` model where each row
corresponds to an account on an install of the app
that has attempted to register with the bouncer to
receive mobile push notifications.

This is the core server table storing registrations
that are potentially registered with the mobile push
notifications bouncer service.
2025-07-14 14:52:38 -07:00
Prakhar Pratyush
3c6a3b0d77 zilencer: Add endpoint to register push device to bouncer.
This commit adds a zilencer endpoint to let self-hosted
servers register push devices to whom mobile push notifications
will be sent.

POST "/api/v1/remotes/push/e2ee/register"
Payload: realm_uuid, push_account_id, encrypted_push_registration,
bouncer_public_key

The post request needs to be authenticated with the server’s API key.

Note: For Zulip Cloud, a background fact about the push bouncer is
that it runs on the same server and database as the main application;
it’s not a separate service.
So, as an optimization, we plan to directly call the
`do_register_remote_push_device` function and skip the HTTP request.
2025-07-14 14:52:38 -07:00
Prakhar Pratyush
5facec1cc3 zilencer: Remove 'user_uuid' parameter of 'get_remote_realm_helper'.
The 'user_uuid' parameter of 'get_remote_realm_helper' was only
used for logging when realm lookup fails, but we've never made
use of that detail in practice.

There is no strong reason to keep that.
2025-07-14 14:52:38 -07:00
Niloth P
c75a48b63b integrations: Remove Phabricator integration.
Phabricator has not been actively maintained since June 2021.
2025-07-14 12:03:48 -07:00
Anders Kaseorg
ea48a283b1 mypy: Add google-re2-stubs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-07-14 14:33:54 -04:00
Tim Abbott
07bb806b28 streams: Extract access_requested_group_permissions.
This code will need to be called from both API endpoints for creating
channels soon.
2025-07-14 07:44:01 -07:00
apoorvapendse
cb487da45a streams: Set system_groups_name_dict in add_subscriptions_backend.
We need system_groups_name_dict in all cases.

Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-07-14 07:44:01 -07:00
apoorvapendse
e2f3b64b35 streams: Extract channel creation permissions check logic.
Prep commit to add the channel creation API
endpoint.
Signed-off-by: apoorvapendse <apoorvavpendse@gmail.com>
2025-07-14 07:44:01 -07:00
Alya Abbott
e6845a9b9a help: Document new options for which messages are marked as read. 2025-07-11 15:55:35 -07:00
Tim Abbott
5b1ec00350 remove_single_newlines: Fix double-space issue.
The Flutter mobile apps don't collapse repeated spaces into single
spaces the same way HTML text does, so leading/trailing whitespace in
these automated messages end up rendering weirdly.

The regex previously didn't handle a corner case that appears in the
latest message.

Co-authored-by: Greg Price <greg@zulip.com>
2025-07-11 15:52:24 -07:00
Aditya Kumar Kasaudhan
f6f4e3886e navigation_view: Add "scheduled" to built-in view fragments.
It was missed in #32528.
2025-07-11 15:48:20 -07:00