This commit fixes the use of `/json/streams/...` by replacing
it with the correct `/api/v1/streams/...`. Also removes
unnecessary `login_user` call when using `api_patch`.
This commit moves tests for default streams and default
stream groups to a new file.
This commit also moves test_guest_user_access_to_streams
test to a different class in test_subs.py since it was
present in DefaultStreamTest class before.
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.
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.
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.
This is in preparation of adding support for generating screenshots of
fixtureless integrations, which would need to get image_path, without
involving fixture_path.
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.
- 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.
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.
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/
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.
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.
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.
Enforce checking the demo organization owner delivery email on
the server-side when converting the organization to a permanent
organization via changing the subdomain.
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.
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.
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.
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.
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.
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).
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.