Commit Graph

19956 Commits

Author SHA1 Message Date
Tim Abbott
30866ce562 api: Increment API feature level to 389. 2025-05-20 13:25:06 -07:00
Sahil Batra
222ccac765 register: Include folder data for web public streams for spectators.
Spectators would only receive data for channel folders that have
at least one web-public stream.
2025-05-20 13:25:06 -07:00
Sahil Batra
509a84403b streams: Refactor get_web_public_streams_queryset.
This commit updates code to not prefetch group setting
fields using select_related as we do not need to
prefetch these settings for all the cases and we instead
prefetch these in callers whenever needed.
2025-05-20 13:25:06 -07:00
Sahil Batra
2f34e6d24c streams: Add API support to update folder of a stream.
Fixes part of #31972.
2025-05-20 13:25:06 -07:00
Sahil Batra
ec96fc9659 streams: Allow adding newly created channels to folders.
Fixes part of #31972.
2025-05-20 13:25:06 -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
5de0f265bd channel_folders: Add support to update channel folders.
Fixes part of #31972.
2025-05-20 13:25:06 -07:00
Sahil Batra
e93667cc06 channel_folders: Add API endpoint to get all channel folders.
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
Alex Vandiver
d87c0b43f1 soft_deactivation: Remove unnecessary nocoverage lines.
These are unnecessary given the `# nocoverage` on the above
`except Exception`.
2025-05-20 10:35:14 -07:00
Alex Vandiver
c6fd943a55 soft_deactivation: Better logging on failures. 2025-05-20 10:35:14 -07:00
Aman Agrawal
f4e6f2f89b events: Add option to send partial data.
Server can now send partial data to the client to help in
developement. We don't want this to be widely used right now,
hence no documentation changes have been made.

This will likely be a check on client capability later.
2025-05-19 16:58:56 -07:00
Alex Vandiver
01e08f0e32 email_server: Attempt to reject unauth'd destinations at RCPT TO time.
This is done in a best-effort way -- we rely on the final ACL check
happening when the message is sent.  However, by then we will be in
the `email_mirror` worker, with no way to convey to the original SMTP
client that the sending failed; giving the client the information will
allow them to provide it back to the end-user, instead of merely being
swallowed up in the worker.
2025-05-19 16:39:44 -07:00
Alex Vandiver
c6e0f0b436 email-mirror: Remove HTTP interface. 2025-05-19 16:39:44 -07:00
Alex Vandiver
1f0cfd4662 email-mirror: Add a standalone server that processes incoming email.
Using postfix to handle the incoming email gateway complicates things
a great deal:

- It cannot verify that incoming email addresses exist in Zulip before
  accepting them; it thus accepts mail at the `RCPT TO` stage which it
  cannot handle, and thus must reject after the `DATA`.

- It is built to handle both incoming and outgoing email, which
  results in subtle errors (1c17583ad5, 79931051bd, a53092687e,
  #18600).

- Rate-limiting happens much too late to avoid denial of
  service (#12501).

- Mis-configurations of the HTTP endpoint can break incoming
  mail (#18105).

Provide a replacement SMTP server which accepts incoming email on port
25, verifies that Zulip can accept the address, and that no
rate-limits are being broken, and then adds it directly to the
relevant queue.

Removes an incorrect comment which implied that missed-message
addresses were only usable once.  We leave rate-limiting to only
channel email addresses, since missed-message addresses are unlikely
to be placed into automated systems, as channel email addresses are.

Also simplifies #7814 somewhat.
2025-05-19 16:39:44 -07:00
Alex Vandiver
31ffe12873 logging_util: Error-proof against weird exc_info. 2025-05-19 16:39:44 -07:00
Mohammad Reza Kianifar
a0488715f3 direct_messages: Use DM groups for 1:1 or self DMs if present.
This is a preparatory refactor for migrating the internal structure of
Recipient objects for group DMs to use the DirectMessageGroup type,
not the legacy PERSONAL type. This step has the message-sending code
path check if a DirectMessageGroupe exists and prefer it if available.

It should have no effect in production other than doing a useless
database query for each outgoing DM, since we do not at present ever
create such DirectMessageGroup objects. (It will not add a marginal
database query once the migration is complete, just during this
transition).
2025-05-18 23:58:59 -07:00
Alya Abbott
d445676807 help: Update label for all channels tab. 2025-05-18 12:41:18 -07:00
Mateusz Mandera
a52bc4d71b slack: Handle integration bots with missing data.
We encountered the following two new cases with integration bots in
Slack imports:
1. Bots without the image_72 field in their data. Such bots should fall
   back to gravatar.
2. Bots whose bot_id is the sender of certain messages, but querying the
   bots.info endpoint returns bot_not_found error. We should create
   dummy accounts in place of such bots.
2025-05-16 13:06:28 -07:00
Mateusz Mandera
c3a138cfa8 import: Truncate channel names to MAX_NAME_LENGTH.
Some exports, such as Slack, might generate channel names longer than
our allowed maximum.
2025-05-16 13:06:28 -07:00
Mateusz Mandera
61b6e823b6 slack: Don't create duplicate reactions.
Just like in the prior commit we add similar code in `get_subscription`,
here we do this for reactions. If two Slack accounts, which will be
merged into one Zulip account, posted the same emoji reaction to a
message, we need to avoid duplication.
2025-05-16 13:06:28 -07:00
Mateusz Mandera
86f17026ac slack: Don't create duplicate subscriptions.
In 1517601e9d we added merging of accounts
with the same email address; but didn't prevent duplication of
subscriptions when two Slack accounts, merged into one Zulip account,
belong to a channel.
2025-05-16 13:06:28 -07:00
whilstsomebody
5c33cc9eab streams: Improve formatting of channel archive/unarchive notifications.
This commit updates the formatting of the channel archive and
unarchive notifications to make the channel name bold and clickable.
The channel name is now displayed as a Markdown link with bold
formatting, ensuring it stands out while remaining a clickable link
to the channel.
2025-05-16 11:39:40 -07:00
whilstsomebody
2780360b00 unarchive: Add support for unarchiving archived channels.
This commit adds support for unarchiving archived channels
by introducing the `is_archived` parameter to the
`PATCH /streams/{stream_id}` API endpoint. Sending a PATCH
request with `is_archived: false` will unarchive the specified
channel.
2025-05-16 11:39:40 -07:00
Alex Vandiver
aa63b40f27 send_email: Enforce in tests that all send_email calls JSON-roundtrip. 2025-05-16 11:30:48 -07:00
Alex Vandiver
222729728c password_reset: Do not place Realm objects into context. 2025-05-16 11:30:48 -07:00
Alex Vandiver
0078310be7 find_account: Do not place Realm objects into context. 2025-05-16 11:30:48 -07:00
Alex Vandiver
1e1292f2f5 email_senders: realm_id can exist but be None. 2025-05-16 11:30:48 -07:00
Sahil Batra
d2ff4bda4c streams: Check creation permission when updating channel privacy.
User who did not have permission to create public channels
could create them by first creating a private or web-public
channel, if they had the permission to create them, and then
changing privacy of that stream to be a public stream.

Similarly user without permission to create private channels
could also create them.

This commit fixes both these bugs.
2025-05-15 15:37:41 -07:00
Aman Agrawal
1dc845f07b users: Allow spectators to access /users API endpoint.
We need this to support faster initial loading time for spectators.
2025-05-15 12:37:29 -07:00
Mateusz Mandera
2cd6f07ffe ldap: Extract sync_groups function from sync_groups_from_ldap.
This extracts the core general group-syncing logic, which is independent
of any LDAP-specific concerns, to a separate function. This allows the
use of this core logic for group sync in other authentication backends.

The code also gets a bit cleaned up in the process to make it more
readable (with some readability tweaks to the log strings as well).
2025-05-15 10:20:28 -07:00
Sahil Batra
54b51823e6 user_groups: Add API support to reactivate a user group.
This commit adds support to reactivate a user group using
`PATCH /user_groups/{user_group_id}` endpoint.

Fixes part of #23568.
2025-05-14 13:24:54 -07:00
Aman Agrawal
136c0f1c44 registration: Enable import from slack using realm registration form.
Co-authored-by: Alex Vandiver <alexmv@zulip.com>
Co-authored-by: Tim Abbott <tabbott@zulip.com>
2025-05-14 13:24:38 -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
Saubhagya Patel
3d33a05455 test_classes: Add functions to get read/unread user IDs for a message.
This commit adds two functions in `zerver/lib/test_classes.py`. The
first function returns the `user_ids` of users for whom the message
is marked as unread. The second function returns the `user_ids` of
users for whom the message is marked read, based on the `message_id`.
2025-05-13 16:04:43 -07:00
Saubhagya Patel
934042d47e zerver: Extract function to parse Enum from string value.
This commit extracts a function from `zerver/views/realm.py` used
for `message_edit_history_visibility_policy` so it can be reused
for other settings.
2025-05-13 16:04:43 -07:00
Tim Abbott
6b26b828b3 test_topic_link_util: Remove unused import. 2025-05-13 16:04:42 -07:00
Kislay Verma
316d1cf285 topic_link_util: Use module to generate correct links.
In this commit, we use the said module instead of using
the `#**..**` syntax for channel and topic links.

Fixes #34608
2025-05-13 15:56:57 -07:00
Kislay Verma
ff27c568c5 topic_link_util: Add module to generate working topic links.
Similar to the frontend `web/src/topic_link_util.ts`, we
introduce a backend module to avoid generating broken
channe/topic links.

Fixes part of #34608
2025-05-13 15:56:46 -07:00
Tim Abbott
97ffd0fd5d users: Use mandatory kwargs in get_user_data. 2025-05-12 15:49:43 -07:00
Aman Agrawal
45d2c8acf5 users: Add parameter to fetch user data for a list of user ids.
This will help us defer loading user data from initial app load
to later when the user data is required.
2025-05-12 15:49:43 -07:00
Aman Agrawal
b459f6f3d2 users: Separate view function to get singer user data.
This will avoid overloading a function with similar parameters when
we add `user_ids` parameter to `get_members_backend`.
2025-05-12 15:13:49 -07:00
Aman Agrawal
cc4b4f5670 users: Add new option in web_channel_default_view.
Added "list of topics" option which will allow users to indicate
that they want to view an inbox style list of topics on visiting
a channel link.
2025-05-09 15:13:56 -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
Lauryn Menard
2b089c7e98 api-docs: Revise POST report-message endpoint descriptions.
Fixes the version of Zulip in the main changes note for this new
endpoint.

Revises the main description and the parameter/error descriptions.
2025-05-07 13:19:29 -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
PieterCK
0a2d7eedf8 integrations: Use real replace_link in Slack webhook.
The real `replace_link` function is now available. This cleans up the
duplicate and switches it with the real one instead.
2025-05-07 12:45:27 -07:00
PieterCK
0814fb88c1 api: Add a new endpoint for message reporting.
This adds a new API endpoint that enables users to report messages for
review by admins or moderators. Reports will be sent to the
`moderate_request_channel`, so it must be configured for this feature to
be enabled.

Fixes part of #20047.

Co-authored-by: Adam Sah <140002+asah@users.noreply.github.com>
2025-05-06 15:59:55 -07:00