Commit Graph

20052 Commits

Author SHA1 Message Date
Alex Vandiver
b9ab93068a email_mirror_server: Swallow and log all TLSSetupExceptions.
The only other flavor we have seen so far is ConnectionResetError, but
that is just as much a client error which we should log and move on,
and not log an exception for.
2025-06-09 10:29:33 -07:00
Lauryn Menard
c797c481b3 demo-orgs: Delete expired demo orgs in archive_messages cron job.
Adds delete_expired_demo_organizations to the archive_messages
management command, which is run as a cron job.

Adds "demo_expired" as a `RealmDeactivationReasonType` to be
used for this specific case of calling do_deactivate_realm.

The function loops through non-deactivated realms that have a
demo organization scheduled deletion datetime set that is less
than the current datetime.
2025-06-07 22:53:01 -07:00
theofficialvedantjoshi
cb07605e52 integrations: Prevent logging of MissingHTTPEventHeaderError.
Fixes #34623.
2025-06-06 18:06:06 -07:00
Anders Kaseorg
0b776e2c15 mypy: Add types-requests-oauthlib, types-uwsgi.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-06-06 11:35:32 -07:00
Tim Abbott
446ba1b538 settings_data: Optimize user_can_access_all_other_users.
This fixes an important issue where this function being called in a
loop can consume as much as 1ms per iteration for users who are in a
lot of groups.
2025-06-06 10:53:03 -07:00
Tim Abbott
0ec07fe4c8 queue: Allow sharding user_activity worker.
This follows the existing patterns for the sharded mobile
notifications worker.
2025-06-06 10:33:20 -07:00
Mohammad Reza Kianifar
df00b68529 messages: Add unread 1:1/self DMs to pm_dict if DM group exists.
In get_raw_unread_data, 1:1 or self messages are added to pm_dict.
However, if a DirectMessageGroup is the recipient, the message is
added to huddle_dict by default.

To keep API compatibility, we override this behavior to populate
pm_dict for 1:1 and self DMs when a DirectMessageGroup exists.
This ensures clients relying on pm_dict continue to work during
and after the migration.

This PR fixes part of issue #25713.
2025-06-05 17:03:49 -07:00
Mohammad Reza Kianifar
30d2d82d02 export_search: Support --dm option for 1:1 DMs using DM group.
Previously, the export_search command only supported the legacy
Personal recipient type for 1:1 direct messages. With this change,
the command first checks for a DirectMessageGroup for the two users
and uses it if present. If not, we fall back to the legacy logic. This
keeps compatibility as we migrate 1:1 DMs to use DirectMessageGroup.
2025-06-05 17:01:45 -07:00
Mateusz Mandera
0c62a2ed4f models: Fix typo in RealmAuthenticationMethod docstring. 2025-06-05 16:08:21 -07:00
PieterCK
be5a6e88e1 integrations: Fix INVALID_SLACK_TOKEN_MESSAGE.
Currently the hyperlink on the "Zulip development community" string is
not properly formatted. This fixes the formatting on the string.
2025-06-05 15:47:39 -07:00
Niloth P
2a2ca01cad integrations: Add FIXTURELESS_SCREENSHOT_CONFIG.
Created a `WEBHOOK_SCREENSHOT_CONFIG` to track those separately, by
renaming the existing `DOC_SCREENSHOT_CONFIG` which contained only the
configs for webhook integrations.

Tracking the screenshot configs separately allows us to generate
the screenshots of all fixtureless integrations in a single batch, and
all webhook integrations in their own separate batch.
2025-06-01 11:38:02 -07:00
Niloth P
9ec98966e3 integrations: Add dataclass FixturelessScreenshotConfig. 2025-06-01 11:38:02 -07:00
Niloth P
0b8e042627 integrations: Split the getters for fixture_path and image_path.
This is in preparation of adding support for generating screenshots of
fixtureless integrations, which would need to get image_path, without
involving fixture_path.
2025-06-01 11:38:02 -07:00
Niloth P
94a5ced243 integrations: Rename ScreenshotConfig to WebhookScreenshotConfig.
This is in preparation to differentiate the current config dataclass
(used for webhooks) from the FixturelessScreenshotConfig that will be
added for non-webhook integrations in the following commits.
2025-06-01 11:38:02 -07:00
Niloth P
9f92ae710f integrations: Remove support for non-webhook example screenshots.
- Removed the BaseScreenshotConfig dataclass, and merge it with
ScreenshotConfig dataclass.
- Simplified get_fixture_and_image_paths.
- Simplified generate_screenshot_from_config in the screenshot script.
- Deleted send_bot_mock_message.
2025-06-01 11:38:02 -07:00
Niloth P
0b69548ded integrations: Remove Nagios fixture used for example screenshot.
Nagios is not a webhook integration, and the fixture is only used to
generate the example screenshot for the doc.

Support for generating the Nagios example screenshot will be added in a
later commit, in a different format and system. Removing this fixture
allows removing the current system logic, without raising errors.
2025-06-01 11:38:02 -07:00
Sahil Batra
d8ae21a4f4 folders: Don't allow archiving a folder if it contains channels. 2025-05-29 15:39:03 -07:00
Sahil Batra
677390d3f6 channel_folders: Add tests for case-insensitive duplicate name check.
This commit adds tests for checking the requirement of folder
names to be unique case insensitively.
2025-05-29 15:39:03 -07:00
Sahil Batra
88b47be938 channel_folders: Pass realm as argument to check_add_channel_folder.
Passing realm explicitly to check_add_channel_folder instead of
using realm field from acting_user seems much cleaner and readable.
2025-05-29 15:39:03 -07:00
Sahil Batra
ad9abb8e2d streams: Use "isinstance" instead of "is" for "Missing" check. 2025-05-29 15:39:03 -07:00
Alex Vandiver
5828bfe8ce i18n: Trim {% trans %} sections by default.
This pulls in changes from the latest django-jinja[^1]
`makemessages.py` monkey-patching.  Specifically, it adds support for
`trimmed`, `notrimmed`, and the `ext.i18n.trimmed` policy.  We enable
that, which removes unsightly and unnecessary whitespace inside of
`{% trans %}` blocks.

[^1]: aac828ca63/django_jinja/management/commands/makemessages.py
2025-05-29 11:58:57 -07:00
Sérgio Glórias
d817bd5faf email_mirror: Also strip "SV:" from subject.
Observed in emails from Nordic countries, the prefix SV: is used instead of RE:.
2025-05-29 10:55:18 -07:00
Lauryn Menard
fd16c2e2b0 templates: Update deactivated organization template for deleted data.
If a realm's data has been scrubbed, update the deactivated realm
to note the URL can be reused, but not that the realm can be
reactivated.

Updates the template for context variables that are no longer used.
2025-05-28 17:32:29 -07:00
Aman Agrawal
e07a17eff5 slack_import: Add instruction to get export file. 2025-05-28 17:18:07 -07:00
Aman Agrawal
b57b783dd8 slack: Don't show error code to users.
We log the error internally and only show invalid token as the
error message.
2025-05-28 17:18:07 -07:00
Aman Agrawal
18b0681d26 slack_import: Show validation error on empty slack access token.
We used to rely on browser to show error for empty slack access
token, but now we are using our own error element for this.
2025-05-28 17:18:07 -07:00
Aman Agrawal
68372f8e03 slack: Change invalid token error message. 2025-05-28 17:18:07 -07:00
Sahil Batra
460c471a29 tests: Move channel access tests to test_channel_access. 2025-05-28 17:02:41 -07:00
Sahil Batra
bf7f567009 tests: Move stream permission tests to test_channel_permissions. 2025-05-28 17:02:41 -07:00
Sahil Batra
4b29d402c6 tests: Move channel creation tests to test_channel_creation. 2025-05-28 17:02:41 -07:00
Shubham Padia
5bbb7ebd1a help-beta: Convert tabs syntax to equivalent MDX syntax.
Fixes #31248.
For cases with zero tabs in our current help center, we were using the
tab syntax just to put a border around the instructions without any tab
label. We do not want that border anymore since Tabs also don't have any
borders. So, we just remove the old tab syntax in that case during our
conversion.

We also move the admonition to asides conversion before the tabs syntax
conversion since the tabs conversion happening first was messing with
the asides conversion and was resulting into some missing closing tags.
We can modify things to work regardless of order, but doesn't seem worth
digging into for a conversion script.
2025-05-28 16:42:16 -07:00
Alex Vandiver
66c123dd43 send_email: Only attempt suppression list removal with credentials.
Servers without any configured credentials raise a NoCredentialsError,
which is not a subclass of botocore.exceptions.ClientError, and hence
abort the password reset attempt.

Check for if we have any credentials at all before we attempt the API
call.
2025-05-28 10:49:17 -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
PieterCK
0dfb709152 slack_data_import: Support converting integration bot messages.
Integration bot messages in Slack may include "blocks" and
"attachments," which are Slack's messaging features.
Currently, these messages aren't processed when converting
Slack export data.

This commit adds support for converting integration bot
messages, as well as other Slack messages containing "blocks"
and "attachments".

Message payload with the block type `rich_text` is skipped because all
messages sent by users have this format.

Fixes #31162.

[1]=https://docs.slack.dev/reference/block-kit/blocks/rich-text-block/
2025-05-23 14:27:31 -07:00
Alex Vandiver
359939ba77 push_notifications: Update for breaking change in aioapns 4.0.
In aioapns 4.0, which we upgraded to in acd7353538, the `key`
parameter is treated as the ASCII-armored string contents of the key,
not the path to the file with that content.

Read the file ourselves, and pass the string it expects.
2025-05-23 11:29:28 -07:00
PieterCK
5b32fa7227 mattermost_import: Add message with faulty HTML to fixture.
This adds a new message sample with faulty HTML content that crashes
`html2text`. The previous test for this mocks a function that raises the
error that this fixture emulates.
2025-05-23 11:28:41 -07:00
Niklas Fiekas
e4d366d159 email_mirror: Also strip "Re[123]:" from subject.
Observed consecutively numbered replies from Outlook.
2025-05-23 11:27:22 -07:00
Alex Vandiver
df74c54f38 find_account: Fix HTML version of email.
This was broken in the refactor in 0078310be7.
2025-05-22 10:31:21 -07:00
Alex Vandiver
198a5a8294 email_senders: Handle a None realm_id.
Some codepaths send an event with `realm_id=None` -- which we still
must trim out of the event, even if we do not add a `realm` value for
them.
2025-05-22 10:30:39 -07:00
PieterCK
201a71b575 mattermost_import: Except error when converting messages HTML.
This adds a try-except block when running html2text when processing raw
messages from HTML to markdown.

convert_html_to_text is added mainly for testing convinience. We don't
have any sample of Mattermosts' problematic content that could trigger
this sort of error yet, so the test mocks convert_html_to_text to raise
error instead.
2025-05-21 16:08:30 -07:00
PieterCK
45b396393f mattermost_import: Log when processing messages.
This logs a line for every batch of messages processed by
process_list_in_batches.
2025-05-21 16:08:30 -07:00
Lauryn Menard
8830373c9e demo-orgs: Disable allowing users to join until owner email set.
Until a demo organization creator sets an email address, we want to
restrict other users from joining the organization. Therefore, we
disable changing the "invite_required" setting for the organization
until they set their email address. Otherwise, the owner could
share the demo organization URL with someone and they could create
an account via the homepage.

Checks the demo organization owner delivery email address state
on the server-side.

Disables updating the organization setting in the web app UI.
2025-05-21 15:52:38 -07:00
Lauryn Menard
c9592c62f8 demo-orgs: Check owner email state when changing subdomain.
Enforce checking the demo organization owner delivery email on
the server-side when converting the organization to a permanent
organization via changing the subdomain.
2025-05-21 15:52:38 -07:00
Lauryn Menard
2fac27afb9 demo-orgs: Check owner email for missed message emails.
It is possible that a demo organization owner will receive a direct
message from a bot when they haven't yet added an email to their
account, e.g., the Notification bot sends a reminder about watching
the intro to Zulip onboarding video.

Adds a check and early return in handle_missedmessage_emails for
this demo organization owner case.
2025-05-21 12:56:27 -07:00
Alya Abbott
98b90a8da1 updates: Add update message (level=16). 2025-05-21 07:33:32 -07:00
Lauryn Menard
28b1a071fe demo-orgs: Schedule onboarding/welcome emails when owner adds email.
When a demo organization creator confirms their email change for
their account, we now schedule the series of onboarding emails
via enqueue_welcome_emails.

If a demo organization is deactivated/deleted before the emails
are sent, any scheduled emails are deleted as part of that process.

We use the current datetime for getting the onboarding schedule
for the onboarding emails in this case, instead of the datetime the
user joined/created the organization.
2025-05-20 16:25:51 -07:00
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