Commit Graph

975 Commits

Author SHA1 Message Date
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
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
Anders Kaseorg
1fdb81b6f8 streams: Remove is_in_zephyr_realm field from database.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-09-16 11:23:11 -07:00
Mateusz Mandera
58427f8ed1 external_auth_id: Add new unique constraint. 2025-08-12 12:10:45 -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
Kislay Verma
f0a88d51cc message_reminders: Add support for notes.
This commit adds the ability for users to include notes
with their message reminders.

Fixes #35070.

Co-Authored-By: Aman Agrawal <amanagr@zulip.com>
2025-08-07 17:13:12 -07:00
Shubham Padia
40132e200b channel-folders: Add order field and backfill it alphabetically. 2025-08-06 16:34:40 -07:00
Mateusz Mandera
40b1f6eb4e confirmation: Replace RealmCreationKey - use Confirmation instead.
Fixes #20028.

There's no reason to have a special `RealmCreationKey` class - the
`Confirmation` system already does this job.

This is somewhat complicated by the need to write a migration for
`RealmCreationKey`->`Confirmation` for pre-existing, valid objects, to
avoid breaking realm creation links that haven't been used yet.
2025-08-04 18:41:15 -07:00
Sahil Batra
072516c2bb channel-folders: Update unique name constraint.
This commit updates code to require unique names for only
non-archived folders in a realm, which means a folder can
use a name which is being used by an archived folder.
2025-08-04 13:22:11 -07:00
Lauryn Menard
7a9b78f1f5 settings: Add user setting to ignore channel folders in left sidebar.
Fixes #35573.
2025-08-01 09:18:19 -07:00
Sahil Batra
6186df4f72 channel_folders: Update MAX_NAME_LENGTH to 60. 2025-07-28 23:12:58 -07:00
Prakhar Pratyush
fc6cd9a966 settings: Add require_e2ee_push_notifications realm setting.
This commit adds a realm setting:
"Require end-to-end encryption for push notification content".

This commit just involves backend & UI changes to add the setting,
the impact of this setting is in the next commit.

Fixes part of #35370.
2025-07-28 17:06:59 -07:00
Alex Vandiver
83acf70d0f models: Add a partial index on unread DMs.
This helps the find_first_unread_anchor call for DMs with a user.
2025-07-22 20:57:36 -07:00
Prakhar Pratyush
7e1afa0e8a push_notification: Send end-to-end encrypted push notifications.
This commit adds support to send encrypted push notifications
to devices registered to receive encrypted notifications.

URL: `POST /api/v1/remotes/push/e2ee/notify`
payload: `realm_uuid` and `device_id_to_encrypted_data`

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 directly call
'send_e2ee_push_notifications' function and skip the HTTP request.
2025-07-22 17:08:55 -07:00
Alex Vandiver
2f4dd72076 push_notifications: Adjust APNs tokens to be case-insensitive in the database.
APNs apparently treats its tokens case-insensitively; FCM does not.
Adjust the `unique_together` to instead be separate partial
constraints, keyed on the `kind` of the PushDeviceToken.
2025-07-22 14:30:13 -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
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
Mateusz Mandera
a61d849e37 ldap: Implement external auth id auth+sync.
Fixes #24104.
2025-07-09 15:31:17 -07:00
opmkumar
8786b12f0c streams: Add can_resolve_topics_group setting.
Fixes #19955.
2025-07-08 16:53:43 -07:00
opmkumar
87d14086af settings: Add web_left_sidebar_unreads_count_summary setting.
Co-authored-by: Akarsh Jain <akarsh.jain.790@gmail.com>

Fixes part of #28759.
2025-06-27 13:50:15 -07:00
Vector73
b612351e48 stream_setting: Add setting for who can move messages out of channel.
Adds `can_move_messages_out_of_channel_group` channel-level
permission for who can move messages out of the channel.

Fixes #34243.
2025-06-24 16:52:53 -07:00
Vector73
703601a5d5 stream_setting: Add setting for who can move messages within channel.
Adds `can_move_messages_within_channel_group` channel-level
permission for who can move messages within the channel.
2025-06-24 16:52:53 -07:00
Sahil Batra
b655bd14ea messages: Use "\x07" as topic for DMs and group DMs.
This commit updates code to use "\x07" as value for
"subject" field of Message objects for DMs and group
DMs, so that we have a unique value for DMs and group
DMs which cannot be used for channel messages.

This helps in avoiding having an empty string value as
topic for DMs, which is also used for "general chat"
channel messages, as large number of DMs in the realm
resulted in PostgreSQL query planner thinking that there
are too many "general chat" messages and thus generated
bad query plans for operations like fetching
"general chat" messages in a stream or moving messages
to and from "general chat" topic.

This change as done for ArchivedMessage and
ScheduledMessage objects as well.

Note that the clients still get "subject" value as
an empty string "".

This commit also adds tests for checking that "\x07"
cannot be used as topic for channel messages.

Fixes #34360.
2025-06-19 10:44:37 -07:00
Vector73
6094bbe8a5 stream_settings: Add new topics_policy setting.
Added `topics_policy` channel setting to configure sending
messages in the empty topic.

Fixes #33549.
2025-06-17 17:05:58 -07:00
Vector73
92672c1339 settings: Add can_set_topics_policy_group realm setting.
Added `can_set_topics_policy_group` realm setting to control
permission to change per-channel `topics_policy`.
2025-06-17 17:05:58 -07:00
Vector73
62c67eae8e settings: Add a new topics_policy realm setting.
Added a new realm setting, `topics_policy` and deprecated
`mandatory_topics` setting as it now replaced by `topics_policy`.

Fixes part of #33549.
2025-06-17 17:05:58 -07:00
Anders Kaseorg
d12601fbee migrations: Add through_fields for NamedUserGroup.direct_subgroups.
https://code.djangoproject.com/ticket/36061

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-06-11 16:25:25 -07:00
Aditya Kumar Kasaudhan
c5f126c6ff navigation_views: Add backend for navigation views in left sidebar.
Fixes part of #32077.
2025-05-23 16:25:08 -07:00
Sahil Batra
202bebda89 streams: Add folder foreign key to Stream table.
This commit also adds "folder_id" field in stream and subscription
objects.

Fixes part of #31972.
2025-05-20 13:25:06 -07:00
Sahil Batra
332abd9e91 channel_folder: Add API to create a channel folder.
This commit also includes code to include channel_folders
data in register response.

Fixes part of #31972.
2025-05-20 13:25:06 -07:00
Sahil Batra
350f6a1fa1 streams: Add ChannelFolder table.
Fixes part of #31972.
2025-05-20 13:25:06 -07:00
bedo
c04558fe31 stream: Add subscriber_count field.
Fixes #34246.

Add subscriber_count field to Stream model to track number of
non-deactivated users subscribed to the channel.
2025-05-13 17:36:53 -07:00
Saubhagya Patel
70e45f45c0 settings: Add setting for marking resolved-topic notices as read.
This commit adds a new personal setting
`resolved_topic_notice_auto_read_policy` which controls how
resolved-topic notices are marked as read for a user.

Fixes #33599.
2025-05-13 16:23:21 -07:00
userAdityaa
354a16fb0a migration: Rename 'populate_db' Client to 'ZulipDataImport'.
This commit:

* Creates a migration to rename any existing Client with
name="populate_db" to "ZulipDataImport".
* Updates populate_db.py to use ZulipDataImport for new
message creation

These changes should make code to identify imported messages
considerably more readable.

Fixes #33909.
2025-05-08 12:18:34 -07:00
Mateusz Mandera
420b84e79c migration: Prepare for backporting of migration 0700.
This follows our usual backporting scheme, occurring e.g.
in #31468. We make the migration depend on the last migration in 10.x,
and create a merge migration to avoid having multiple leafs.
2025-05-07 12:56:33 -07:00
Mateusz Mandera
b8ed03f5b7 ldap: Add migration to fix incorrect system group memberships.
In #34510 we fixed the underlying bug in the ldap integration, which
would cause users to end up with their system group memberships not
matching their .role value. However, users who may already be in that
state still need to be fixed through a migration. We implement that
here.

There are two things we fix here:
1. Group memberships. The user should have a direct group membership
   for the specific system group implied by their .role.
2. We want to also add the missing RealmAuditLog entry.
2025-05-06 12:54:35 -07:00
Anders Kaseorg
acd7353538 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-05-05 09:10:19 -07:00
Aman Agrawal
733817cb51 reminders: Add API endpoint to schedule reminders. 2025-05-02 16:48:00 -07:00
Aman Agrawal
9d3279caf4 models: Add request_timestamp field to ScheduledMessage table.
This just records the time when the user created the
request to schedule a message or set a reminder.

This would be unused but is future-proofing against a world
where we decide to edit the strings or UI to show when you
asked for the thing.
2025-04-24 09:43:58 -07:00
bedo
c0a9ca8e9a tests: Pass update_fields to all stream.save().
A prep PR to 34308.

Explicitly pass the fields to be updated,
This increases performance but most importantly
prevents overwriting the db-saved value of
"subscriber_count" field (added in an upcoming PR)
with the in-memory default value of 0,
since "subscriber_count" will only be updted
via the db.

Migrate some tests to use do_ functions instead of
direclty modifying the state.
2025-04-15 10:28:18 -07:00
Elsa Kihlberg Gawell
f6b3d59c35 migration: Fix topic name for imported DMs from third-party exports.
Currently, imported direct messages from third-party exports might have
a non-empty string as their topic name.

This migration updates the topic names for all imported third-party DMs
and GDMs to an empty string if they aren’t already.

Fixes #29466.

Co-authored-by: Pieter CK <pieterceka123@gmail.com>
2025-03-25 16:38:21 -07:00
Mateusz Mandera
60e166bcd0 migrations: Fix migration 0574 to handle edge-case DirectMessageGroups.
The Django ORM query would not work correctly for pathological
DirectMessageGroups with no Subscription rows. When the Subquery gave
empty results, the UPDATE would set group_size to null - when the point
of the migration was exactly to make sure this column is always set and
allow making the column non-nullable in 0575.

Such DirectMessageGroups can occur as a result doing .delete() on all
UserProfiles that were in the group - or by doing realm deletion via
either .delete() or `manage.py delete_realm`.

The natural choice for group_size of these objects is 0. The simple SQL
query naturally achieves this result, without needing any special
handling for this case.
2025-03-25 10:30:27 -07:00
Prakhar Pratyush
0774d80f8e migration: Rename "(no topic)" to empty string topic.
This commit adds migration to move messages from "(no topic)"
to the empty string topic.

It'll help in our plan to interpret messages sent to
"(no topic)" as being sent to "".

That interpretation will be particularly helpful for older
clients where sending messages with empty topic input box
currently results in messages being sent to "(no topic)" topic.

In 0680, we moved messages from the "general chat" topic
to the empty string topic. Therefore, we skip moving messages
from "(no topic)" if an empty string topic already exists.

Such cases—where both "(no topic)" and an empty string topic
coexist in a channel—should be rare. The solution is to either
manually rename the "(no topic)" topic or manually move its
messages to the empty string topic.
2025-03-19 11:39:26 -07:00
Alex Vandiver
aebc9081b8 migrations: Generate statistics for subject vs channel-messages.
These extended statistics allow the query planner to know that the
prevalence of empty topics is very different in DMs, as opposed to
channel messages.  The `ALTER STATISTICS` adjusts the size of the
"most common value" list -- it must be large enough to include the
empty-topic channel messages to be fully effective.  Having this list
be over-large does not carry much risk, however.

The `ANALYZE zerver_message` step may be quite slow.
2025-03-19 09:39:20 -07:00
Alex Vandiver
fd127b4191 messages: Remove unconditional topic indexes. 2025-03-18 09:34:11 -07:00
Alex Vandiver
33e1d583bf messages: Add new conditional versions of subject indexes.
Indexes on topic ("subject") are polluted by the existence of DMs,
which all have empty topics, and as such skew the statistics greatly.
This is particularly important given the new use of the empty topic
for the "general chat" function -- left as-is, the database makes bad
query plans because it believes the topic is vastly more common than
it actually is.

We move the old indexes to a new name with `_all`, and
recreate (concurrently) the same indexes but with a condition on
is_channel_message.  These new indexes are unused at current, until
the query-building logic adds limits on is_channel_message; see the
following commit.
2025-03-18 09:34:11 -07:00
Alex Vandiver
eba1c3afd4 messages: Mark is_channel_message as non-null. 2025-03-18 09:34:11 -07:00
Alex Vandiver
bca862e243 migrations: Backfill is_channel_message. 2025-03-18 09:34:11 -07:00