Commit Graph

18373 Commits

Author SHA1 Message Date
Lauryn Menard dfc6eab8a0 api-docs: Update PATCH /settings for channel.
Updates the API doc for PATCH /settings endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 8a0c8cecf8 api-docs: Update GET /server_settings for channel.
Updates the API doc for GET /server_settings endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard c87715a6ff api-docs: Update POST /register for channel.
Updates the API doc for POST /register endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard f88fa28f55 api-docs: Update POST /invites/multiuse for channel.
Updates the API doc for POST /invites/multiuse endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 8161bc16c8 api-docs: Update POST /invites for channel.
Updates the API doc for POST /invites endpoint to use channel in
descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard a4f4e61eef api-docs: Update POST /users/me/subscriptions/properties for channel.
Updates the API doc for POST /users/me/subscriptions/properties
endpoint to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard b74ee5f740 api-docs: Update PATCH /realm/user_settings_defaults for channel.
Updates the API doc for PATCH /realm/user_settings_defaults
endpoint to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 0fefbdd5b3 api-docs: Update DELETE /realm/emoji/{emoji_name} for channel.
Updates the API doc for DELETE /realm/emoji/{emoji_name}
endpoint to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 66f93cf9d3 api-docs: Update /users/{user_id}/subscriptions/{stream_id} for channel.
Updates the API doc for /users/{user_id}/subscriptions/{stream_id}
endpoint to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 9717aeea43 api-docs: Update /users/me/muted_users/{muted_user_id} for channel.
Updates the API doc for /users/me/muted_users/{muted_user_id} endpoint
to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 880ab441f6 api-docs: Update POST /user_topics for channel.
Updates the API doc for POST /user_topics endpoint to use channel in
descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard c34e3a9eba api-docs: Update PATCH /users/me/subscriptions/muted_topics for channel.
Updates the API doc for PATCH /users/me/subscriptions/muted_topics
endpoint to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 785b036a55 api-docs: Update DELETE /users/me/subscriptions for channel.
Updates the API doc for DELETE /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 8a75476cb6 api-docs: Update PATCH /users/me/subscriptions for channel.
Updates the API doc for PATCH /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 62cac75ebc api-docs: Update POST /users/me/subscriptions for channel.
Updates the API doc for POST /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 1f6a01eb28 api-docs: Update GET /users/me/subscriptions for channel.
Updates the API doc for GET /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard a090dc32a1 api-docs: Update /users/me/{stream_id}/topics for channel.
Updates the API doc for /users/me/{stream_id}/topics endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 559ba55690 api-docs: Update PATCH /messages/{message_id} for channel.
Updates the API doc for PATCH /messages/{message_id} endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard bc421afa25 api-docs: Update GET /messages/matches_narrow for channel.
Updates the API doc for GET /messages/matches_narrow endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 551791ca16 api-docs: Update POST /messages/flags for channel.
Updates the API doc for POST /messages/flags endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 03b0a8785a api-docs: Update GET /messages/{message_id}/history for channel.
Updates the API doc for GET /messages/{message_id}/history endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard fd9e9c6207 api-docs: Update POST /messages for channel.
Updates the API doc for POST /messages endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard aea4216970 api-docs: Update GET /messages for channel.
Updates the API doc for GET /messages endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard ce047d5c5a api-docs: Update DELETE /default_streams for channel.
Updates the API doc for DELETE /default_streams endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 43cb33df1a api-docs: Update POST /default_streams for channel.
Updates the API doc for POST /default_streams endpoint to use channel
in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 4d0325da99 api-docs: Update /scheduled_messages/{scheduled_message_id} for channel.
Updates the API doc for PATCH /scheduled_messages/{scheduled_message_id}
endpoint to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 3d33490a32 api-docs: Update descriptions in POST /scheduled_message for channel.
Updates the API documentation for the POST /scheduled_message endpoint
to use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 3c11872ebd api-docs: Update descriptions in POST /drafts for channel.
Updates the API documentation for the POST /drafts endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard ff49567c16 api-docs: Update descriptions in /mark_topic_as_read for channel.
Updates the API documentation for the /mark_topic_as_read endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard b8a91278f6 api-docs: Update descriptions in /mark_stream_as_read for channel.
Updates the API documentation for the /mark_stream_as_read endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 030863a585 api-docs: Update descriptions in /get_stream_id for channel.
Updates the API documentation for the /get_stream_id endpoint to
use channel in descriptions instead of stream.

Part of the stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 46b9456b31 api-docs: Use "Channel" for components schema names in zulip.yaml.
Part of stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard 6c643f2530 api-docs: Update descriptions in shared schemas to use channel.
Updates field descriptions in schema components and parameters to
use channel instead of stream.

Part of stream to channel rename project.
2024-05-20 09:31:56 -07:00
Lauryn Menard d44196bed2 api-docs: Update get-events description text to use channel.
Updates description's in /api/get-events to use channel instead
of stream.

Note that any shared schemas used for this endpoint's documentation
will be updated in other commits in this series.

Part of stream to channel rename project.
2024-05-20 09:31:56 -07:00
bedo acec5108c5 import/export: Map each message id to its attachments.
Fixes #29350
2024-05-20 09:18:49 -07:00
Prakhar Pratyush c798d192dc message_send: Update do_send_messages codepath to send event on commit.
Earlier, we were using 'send_event' & 'queue_json_publish' in
'do_send_messages' which can lead to a situation where we enqueue
events but the transaction fails at a later stage.

Events should not be sent until we know we're not rolling back.
2024-05-19 23:18:43 -07:00
Mateusz Mandera 27c4e46b30 do_deactivate_realm: Add deactivation_reason kwarg.
It's going to be helpful in the future to record the reason for realm
deactivation.
- For information tracking
- For making a distinction between cases where we can allow realm owners
  to reactivate their realm via a self-serve flow (e.g.
  "owner_request") vs where we can't (ToS abuse).
2024-05-19 23:07:28 -07:00
evykassirer 96c9950115 composebox_typeahead: Convert module to typescript. 2024-05-16 14:53:26 -07:00
Sahil Batra aa83812b1b user_groups: Rename are_both_setting_values_equal function.
This commit renames are_both_setting_values_equal function
to are_both_group_setting_values_equal to make it clear
that this function is used to compare value of group
settings.
2024-05-16 12:58:20 -07:00
Sahil Batra 7db7b3f94d groups: Move functions for updating settings to "lib.user_groups".
This commit moves validate_group_setting_value_change,
are_both_setting_values_equal and parse_group_setting_value
functions, which are used for updating the group settings, to
"zerver.lib.user_groups" as these functions will also be used for
group based realm and stream settings and "zerver.lib.user_groups"
file seems a better place to place such functions which are used
at multiple places.

For same reasons, we also move GroupSettingChangeRequest dataclass
to "zerver.lib.user_groups" file.
2024-05-16 12:58:20 -07:00
Tomas Fonseca 753b8e1f6f markdown: Added error handling for invalid time zones.
If an invalid timezone (such as +32h) was provided, the
timestamp.astimezone call would throw an exception, causing the
message send to fail. Replace that with a user-facing error.

Fixes #19658.
2024-05-16 09:38:25 -07:00
Aman Agrawal 7203661d99 support: Set discounted price instead percentage for customers.
This allows us to set the price of a plan exactly as discussed with
the customer.
2024-05-16 02:18:43 -07:00
Tim Abbott 1d52d08803 api_examples: Fix failing invitation links test.
This system is too fragile with hardcoded IDs; we should be asserting
that the preparatory requests succeeded to make these easier to debug.
2024-05-15 15:01:08 -07:00
Vector73 431beae96f api_documentation: Document "/invites/multiuse/{invite_id}" endpoint. 2024-05-15 12:05:40 -07:00
Lauryn Menard ab0fc402e0 api-docs: Update feature level 261 documentation.
The original changes for this feature level are in
commits a6be1d101 and 7b42c802b.
2024-05-15 21:01:05 +02:00
tnmkr 51635c81fc streams: Set creator for some initial streams in populate_db.
This is a follow-up to #29425. It assigns creator to three streams
that are used in tests and another two that aren't. For tests,
we assign a guest, an admin and an owner as creator.
2024-05-15 11:21:46 -07:00
Prakhar Pratyush e264b12066 zulip_updates: Send an introductory message before the first update.
To help users focus on the onboarding experience, we no longer
send the introductory "Zulip updates" message as a part of
onboarding.

Now, we send the introductory message just before the first
update message.

Fixes #30053.
2024-05-15 11:19:03 -07:00
Sahil Batra a85eb2110d test_message_move_topic: Define assert_has_visibility_policy once.
We just define assert_has_visibility_policy once instead of just
defining it in three different tests.
2024-05-15 10:57:23 -07:00
Sahil Batra 1811dd9b47 test_realm: Remove set_up_db.
This commit removes set_up_db, which called realm.save to
update the settings, and its calls are replaced with either
self.assertEqual (which is enough to verify the initial value)
or a "do_.." function call to set the setting to initial value.

It is better to avoid calling "realm.save" and instead use the
"do_.." functions to set the settings.

There are places where it is easy to just call "do_.." function
as default value is not the first value in the list of test values.
2024-05-15 10:57:23 -07:00
Sahil Batra 6e3c0690aa test_realm: Improve do_test_realm_update_api.
This commit improves how we handle video_chat_provider
and jitsi_server_url settings in do_test_realm_update_api.

For video_chat_provider, there is no use for calling
update_with_api_multiple_value and it can be handled
similar to other tests, so did that change and also
added one more value to test, so that it actually
tests changing the setting.

We need to handle jitsi_server_url separately as even
though value is a string, we need to serialize to
JSON. We do not use a separate function for it as
this is the only setting to handle differently and
update_with_api_multiple_value anyways was added in
bbff797a93 to update multiple settings in a request
which we are not doing here.

As a result of above changes, update_with_api_multiple_value
function is also removed.
2024-05-15 10:57:23 -07:00
Tim Abbott 7ec6f5296e migrations: Fix buggy migration failing to advance. 2024-05-14 16:54:06 -07:00
roanster007 80634eb32b message_send: Add forged_timestamp to internal_prep_stream_message.
This commit adds the "forged_timestamp" parameter to the
"internal_prep_stream_message" method of "actions/message_send".

This is a preparatory commit, that can be used for sending messages
at a forged time in scripts for generating screenshots of messages.
2024-05-14 16:17:44 -07:00
roanster007 0a7c0ea326 refactor: Relocate screenshots scripts to new tools/screenshots dir.
This commit relocates all the scripts in the tools directory which
are used for auto-generating screenshots to the new
tools/screenshots directory to avoid cluttering the tools/ root.
2024-05-14 16:17:44 -07:00
Sahil Batra 7b42c802b1 invites: Add include_realm_default_subscriptions parameter.
This commit adds include_realm_default_subscriptions parameter
to the invite endpoints and the corresponding field in
PreregistrationUser and MultiuseInvite objects. This field will
be used to subscribe the new users to the default streams at the
time of account creation and not to the streams that were default
when sending the invite.
2024-05-14 14:20:07 -07:00
Sahil Batra a6be1d1018 invites: Subscribe to default streams when not allowed to subscribe others.
This commit changes the code to subscribe the invited user to default
streams even if the user who invited the new user was not allowed to
subscribe others to streams.
2024-05-14 14:20:07 -07:00
Sahil Batra 8bca565218 groups: Pass old setting value for can_mention_group.
This commit adds support to pass object containing both old and new
values of the can_mention_group setting, as well as detailed API
documentation for this part of the API system.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
Co-authored-by: Greg PRice <greg@zulip.com>
2024-05-14 12:17:15 -07:00
Sahil Batra 0cc2244aac groups: Migrate group creation and edit endpoints to typed_endpoint. 2024-05-14 12:17:15 -07:00
Sahil Batra 43810f76ea openapi: Fix typo in zulip.yaml. 2024-05-14 12:17:15 -07:00
Mateusz Mandera 160076fdfa import: Fix import of Stream.creator field.
When importing a Stream, UserProfiles don't yet exist. so trying to
import stream.creator fails with something like:

```
psycopg2.errors.ForeignKeyViolation: insert or update on table
"zerver_stream" violates foreign key constraint
"zerver_stream_creator_id_65aeba7e_fk_zerver_userprofile_id"
DETAIL:  Key (creator_id)=(5) is not present in table "zerver_userprofile".
```
2024-05-13 20:11:28 -07:00
Prakhar Pratyush 0cddc8a6a6 onboarding: Fix topic names not being translated correctly.
In 'send_initial_realm_messages', the topics names were not
being translated properly as they were computed outside the
with `override_language` block.

Now, we use 'send_initial_realm_messages' inside a with
'override_language' block in the caller. This fixes the bug.

Note: We are using 'override_language' block in the caller
and not within the function as it helps to avoid indenting
everything inside the function.
2024-05-13 16:06:10 -07:00
Prakhar Pratyush aad66674e7 onboarding: Fix the query for 'greetings_message'.
The query to fetch one of the greetings message based on
content wasn't taking translation into account that would
result in a bug in realms using non-english language.

This commit updates the query to fix the bug.
2024-05-13 16:06:10 -07:00
Alya Abbott 5aeeafd39c portico: Improve message for deactivated, invalid and moved orgs. 2024-05-13 12:44:20 -07:00
Alya Abbott 8a51c42c07 onboarding: Modify content on onboarding messages.
- Tighten up the content.
- Use pretty quotes.
- Reorder "experiments" topic to appear after "start a conversation"
  in Inbox.
- Drop reference to messages being starred (not implemented yet).
2024-05-12 17:24:17 -07:00
Prakhar Pratyush 15a7870d2e onboarding: Use 'remove_single_newlines' once, while sending message.
Instead of applying 'remove_single_newlines()' to individual
contents when declared, we use it once while prepping up
message in 'internal_prep_stream_message_by_name'.

Just for the code to be less finnicky.
2024-05-12 17:24:17 -07:00
Prakhar Pratyush 643998fcfa onboarding_steps: Rename 'hotspots' files to 'onboarding_steps'. 2024-05-10 12:30:22 -07:00
Prakhar Pratyush bf2360bcf2 onboarding_steps: Remove hotspot as an onboarding_step.
Earlier, hotspots and one-time notices were the valid
type of onboarding step.

Now, one-time notice is the only valid type.

Fixes #29296.
2024-05-10 12:30:22 -07:00
Prakhar Pratyush e8769f80a6 onboarding_steps: Rename 'copy_hotspots' function.
The function is used for any type of onboarding step
i.e. not limited to Hotspot.

This commit updates the function and variables name
to reflect the above mentioned behaviour.
2024-05-10 12:30:22 -07:00
Vector73 9f8d738252 openapi: Document android_gcm_reg_id endpoints.
This commit adds API documentation for "/users/me/android_gcm_reg_id:post"
and "/users/me/android_gcm_reg_id:delete" endpoints.

Co-authored-by: Suyash Vardhan Mathur <suyash.mathur@research.iiit.ac.in>
2024-05-10 08:37:12 -07:00
Vector73 b047bf0d79 openapi: Document apns_device_token endpoints.
This commit adds API documentation for "/users/me/apns_device_token:post"
and "/users/me/apns_device_token:delete" endpoints.

openapi: Document android_gcm_reg_id endpoints.

Co-authored-by: Suyash Vardhan Mathur <suyash.mathur@research.iiit.ac.in>
2024-05-10 08:37:12 -07:00
Prakhar Pratyush ac2152fdfd onboarding: Replace channel messages in new organizations.
As a part of improving onboarding experience, this
commit updates the channels and messages initially
available in new orgs.

Fixes #29297.
2024-05-09 14:05:35 -07:00
Prakhar Pratyush 7ea66dbec5 onboarding: Mark channel name for translation.
Mark the channel name of the initial channel created during
realm creation for translation.

It doesn't mark the topic names and description for translation
because we are planning to remove these topics and update the
description as a part of improving the onboarding experience.
2024-05-09 14:05:35 -07:00
Prakhar Pratyush 61e606f656 onboarding: Remove 'core team' private channel.
We no longer create the 'core team' private channel when
a realm is created.

Earlier, "New user announcements" channel was set to the
"core team" channel. Now it is disabled by default.

populate_db still creates the 'core team' channel to
represent a private channel.
2024-05-09 14:05:35 -07:00
Prakhar Pratyush 6baf981aa5 test_import_export: Fix a flaky test due to random reactions added.
The reactions added to messages in the test database are
random in nature, so there is a possibility of any number
of reaction records in the exported user data.

The test now verifies the reaction which was added in the test
itself.

Earlier, the test was assuming the reaction added in the test
is the only record in the exported data.

That would result in a flaky behavior. This commit fixes the
flaky behavior.
2024-05-09 14:05:35 -07:00
Prakhar Pratyush 20fbba6375 test_realm: Fix a flaky test due to random message populated.
The messages populated in the test database are random in nature,
so there is a possibility of any number of messages in
'new_stream_announcements_stream' in 'test_merge_streams'.

Earlier, the test was assuming of exactly one message in that
stream.

That would result in a flaky behavior. This commit fixes the
flaky behavior.
2024-05-09 14:05:35 -07:00
Prakhar Pratyush fd335c06eb test_message_fetch: Fix a flaky test due to random message populated.
The messages populated in the test database are random in nature,
so there is a possibility of more than one resolved topic
messages returned by 'self.get_and_check_messages()' query
in 'test_get_messages_for_resolved_topics'.

That would result in a flaky behavior. This commit fixes the
flaky behavior.
2024-05-09 14:05:35 -07:00
Mateusz Mandera 9406bfbc0a analytics: Store realm disk space used as a CountStat.
Fixes #29632.

The issue description explains this well:

We currently recalculate `currently_used_upload_space_bytes` every file
upload, by dint of calling `flush_used_upload_space_cache`  on
save/delete, and then immediately calling
`user_profile.realm.currently_used_upload_space_bytes()` in
`notify_attachment_update`.  Since this walks the Attachments table,
recalculating this can take seconds in large realms.

Switch this to using a CountStat, so we don't need to walk significant
chunks of the Attachment table when we upload an attachment.  This will
also give us a historical daily graph of usage.
2024-05-09 10:54:44 -07:00
Mateusz Mandera 4c4a443002 models: Add (realm, create_time) index for the Attachment table. 2024-05-09 10:54:44 -07:00
Mateusz Mandera 224ea3aaed retention: Add .restored_timestamp to ArchiveTransaction.
This is just generally useful for tracking and debugging.
2024-05-09 10:54:44 -07:00
Alex Vandiver a1a14527db migrations: Update 0516 to handle invites with non-default streams.
We update the existing migration, because any deployment which had
invitations with non-default streams in this state cannot have
proceeded past this migration yet.
2024-05-09 09:41:36 -07:00
Sahil Batra 3f80bc1b41 groups: Allow setting anonymous group to settings while editing.
This commit adds support to set can_mention_group setting to
anonymous group while editing groups.
2024-05-08 18:20:14 -07:00
Sahil Batra 23fdb73353 groups: Allow setting anonymous group to settings while creation.
This commit adds support to set can_mention_group setting to
anonymous group while group creation.
2024-05-08 18:20:14 -07:00
Sahil Batra 206014f263 groups: Update group objects to pass anonymous groups data for settings.
This commit updates code to handle the can_mention_group field
correctly if the setting is set to an anonymous user group.
2024-05-08 18:20:14 -07:00
Sahil Batra 6b68d7e80d user_groups: Update access_user_group_for_setting.
This commit updates access_user_group_for_setting
to support setting anonymous user groups for
different settings.

There are some lines without coverage as of this
commit, but the next few commits would add tests
covering those.
2024-05-08 18:20:14 -07:00
Sahil Batra ce9f4231c7 groups: Fix queries to get members and sugroups for user group objects.
This commit fixes the queries to get members and subgroups for
user group objects returned by user_groups_in_realm_serialized
to not include the UserGroup objects which are not linked to a
NamedUserGroup object, since the function only returns data for
NamedUserGroup objects.
2024-05-08 18:20:14 -07:00
Vector73 ac4dde24ae realm: Add an alias `realm_url` and deprecate `realm_uri` in the API.
The naming `uri` is deprecated while `url` should be used in order to
satisfy URL standards. For this reason, four endpoints are affected:

* The response content of three endpoints `/server_settings`,
`/register` and `/realm` that contain a field `realm_uri` is
changed to `realm_url`.

* In one of the common fields for all mobile push notifications payloads,
`realm_url` field is now added as an alias to `realm_uri`.

For backwards compatibility, we keep the field `realm_uri` and add
an alias `realm_url`.

Co-authored-by: Junyao Chen <junyao.chen@socitydao.org>
2024-05-08 17:39:15 -07:00
Prakhar Pratyush 00474608c5 zulip_update: Send group DM for realm imported from other product.
When the export is NOT generated by another zulip server,
while importing:
* Set the 'zulip_update_announcements_level' to the latest level
as we don't want to send all the older update messages to them.

* Send a group DM to admins, suggesting them to configure the
stream in order to avoid missing future update messages.

Fixes #29041.
2024-05-08 17:05:59 -07:00
Prakhar Pratyush cc793612f0 export: Create REALM_EXPORTED audit log for exports via shell.
Earlier, we were creating RealmAuditLog with REALM_EXPORTED
event_type when export of public data took place via organization
settings panel.

We were not creating the audit log when the export was executed
via shell i.e './manage.py export'.

This commit creates the audit log in that case too. It will
help during import to distinguish readily between imports
from another Zulip server vs imports from another product.
2024-05-08 16:16:37 -07:00
Vector73 8ab526a25a models: Replace realm.uri with realm.url.
In #23380, we are changing all occurrences of uri with url in order to
follow the latest URL standard. Previous PRs #25038 and #25045 has
replaced the occurences of uri that has no direct relation with realm.

This commit changes just the model property, which has no API
compatibility concerns.
2024-05-08 11:12:43 -07:00
Prakhar Pratyush 5b3641d92d help: Move 'channels-and-topics' to 'introduction-to-topics'.
Introduction to channel is now moved out as a new article,
the 'channel-and-topics' contains only introduction to topics,
hence renamed.
2024-05-07 16:51:48 -07:00
Alya Abbott 318cb2bfce help: Create an introduction to channels page.
Replaces "Browse and subscribe to channels".

Co-authored-by: Prakhar Pratyush <prakhar@zulip.com>
2024-05-07 16:51:48 -07:00
Alya Abbott 7fc806ef82 help: Consolidate introduction to topics into one article.
Also create dedicated channels and topics sections in sidebar.

Makes 'start a new topic', a section in introduction to topics
page.

Co-authored-by: Prakhar Pratyush <prakhar@zulip.com>
2024-05-07 16:51:48 -07:00
Mahhheshh 1198785c62 analytics: Improve do_increment_logging_stat performance.
The previous implementation using Django's `get_or_create` for
`do_increment_logging_stat` involved two separate database queries,
potentially leading to race conditions.

Use an `ON CONFLICT ... DO UPDATE` (aka "upsert") query, which
eliminates race conditions and improves performance.  This is mildly
complicated due to the different unique indexes across the various
tables, and the need for bug-for-bug compatibility with the previous
implementation.

Fixes #28947.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2024-05-06 16:34:01 -07:00
Dhruv Goyal 178d4f364b documentation: Described display_in_profile_summary field as optional.
Fixes #29908.
2024-05-06 15:32:31 -07:00
Anders Kaseorg f13e94d9ae requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-06 12:56:30 -07:00
Anders Kaseorg 042f28dca8 invites: Broaden invite_expires_in_minutes type.
It may be internally recomputed using .total_seconds() / 60, which is
a float.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-06 12:56:30 -07:00
Anders Kaseorg 8b47b5dc34 send_email: Assert custom email payload is a str.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-06 12:56:30 -07:00
Anders Kaseorg 0dff5f0a27 narrow: Add maybe_negate annotation needed by mypy 1.10.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-06 12:56:30 -07:00
Alex Vandiver b2ebe34500 missedmessage_emails: Backoff the background worker retries. 2024-05-06 12:50:27 -07:00
Prakhar Pratyush 422f5c4e1a help: Rename unarchive_stream management command to unarchive_channel. 2024-05-06 11:18:45 -07:00
Prakhar Pratyush 64c251089d help: Update 'stream' to 'channel' in tab sections. 2024-05-06 11:18:45 -07:00
Mateusz Mandera 87007df8eb webhooks: Rename remaining stream references to channel.
Note: This doesn't change the occurences in the Zapier integration doc,
since they refer to pieces of the UI in Zapier, which may still be using
the "Stream" terminology.
2024-05-06 09:07:57 -07:00
Mateusz Mandera 3c4ab345d0 webhooks: Rename append-stream-name.md->append-channel-name.md. 2024-05-06 09:07:57 -07:00
Mateusz Mandera a119160da3 webhooks: Rename recommended_stream_name->recommended_channel_name. 2024-05-06 09:07:57 -07:00
Mateusz Mandera 1267e10094 webhhoks: Rename stream->channel in bitbucket doc. 2024-05-06 09:07:57 -07:00
Mateusz Mandera 5c9f3cd08c webhooks: Rename create-stream.md to create-channel.md. 2024-05-06 09:07:57 -07:00
Alex Vandiver 3662a6ded9 migrations: Merge 0517 as a no-op.
Migration 0517 migration was already run as 0497 on `main`, but was
accidentally omitted on 8.x until this point.

Merge the 0517 migration into the migration history.  It is included
as a no-op in `main` because it has already run as 0497.
2024-05-06 09:03:02 -07:00
Mateusz Mandera 2b927e355a webhooks: Rename stream->channel in some remaining random places. 2024-05-04 19:01:51 -07:00
Mateusz Mandera 2099afe79b webhooks: Rename stream->channel in function name in clubhouse code. 2024-05-04 19:01:51 -07:00
Mateusz Mandera d7b2655ad2 webhooks: Rename stream_name to channel_name arg. 2024-05-04 19:01:51 -07:00
Mateusz Mandera fef299510f webhooks: Rename assert_stream_message to assert_channel_message. 2024-05-04 19:01:51 -07:00
Mateusz Mandera 4e968869a2 webhooks: Rename api_stream_message to api_channel_message in tests. 2024-05-04 19:01:51 -07:00
Mateusz Mandera dc31347ac4 webhooks: Rename STREAM_NAME to CHANNEL_NAME in tests. 2024-05-04 19:01:51 -07:00
Lauryn Menard 5acd059c38 help-relative-links: Update relative help links for channel rename. 2024-05-03 13:05:57 -07:00
Lauryn Menard d10ad01997 help: Rename and redirect archive-a-stream for channel. 2024-05-03 13:05:57 -07:00
Lauryn Menard c1175f2e55 help: Rename and redirect change-the-privacy-of-a-stream for channel. 2024-05-03 13:05:57 -07:00
Lauryn Menard 500f476de9 help: Rename and redirect change-the-stream-description for channel.
This also contains in-file edits for help/message-retention-policy.md,
help/create-a-channel.md, and help/configure-automated-notices.md.
2024-05-03 13:05:54 -07:00
Lauryn Menard c10c570b89 help: Rename and redirect rename-a-stream for channel. 2024-05-03 13:02:20 -07:00
Lauryn Menard b714bd9eec help: Rename and redirect set-default-streams-for-new-users for channel. 2024-05-03 13:02:20 -07:00
Lauryn Menard fbc66f45ea help: Rename and redirect configure-who-can-invite-to-streams re:channel. 2024-05-03 13:02:20 -07:00
Lauryn Menard c65c2b4a33 help: Rename and redirect configure-who-can-create-streams re:channel. 2024-05-03 13:02:20 -07:00
Lauryn Menard c931966e1b help: Rename and redirect stream-sending-policy for channel. 2024-05-03 13:02:20 -07:00
Lauryn Menard 5342d4ecfb help: Rename and redirect stream-permissions for channel. 2024-05-03 13:02:19 -07:00
Lauryn Menard 95b03ce6e1 help: Rename and redirect manage-user-stream-subscriptions for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 859340c914 help: Rename and redirect mute-a-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 4908f1c5dc help: Rename and redirect stream-notifications for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard d97571e1df help: Rename and redirect manage-inactive-streams for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 93dd1e9b25 help: Rename and redirect move-content-to-another-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 4f97c7b202 help: Rename and redirect change-the-color-of-a-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 47ecc4989d help: Rename and redirect pin-a-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 696f578c8e help: Rename and redirect add-or-remove-users-from-a-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard a4c63c5ad0 help: Rename and redirect view-stream-subscribers for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 049ce10b6f help: Rename and redirect unsubscribe-from-a-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard b4e67ee564 help: Rename and redirect browse-and-subscribe-to-streams for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 9c353d812e help: Rename and redirect message-a-stream-by-email for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard bd91c82862 help: Rename and redirect create-a-stream for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 14b899eb20 help: Rename and redirect create-streams for channel. 2024-05-03 12:55:39 -07:00
Lauryn Menard 4dbda25e2e help: Rename and redirect streams-and-topics for channel. 2024-05-03 12:55:39 -07:00
Mateusz Mandera eed98edb9d help: Document configuration of SCIM with Microsoft Entra ID. 2024-05-02 18:12:21 -07:00
Tim Abbott 0a756c652c push_notifications: Shard mobile push notifications. 2024-05-02 14:25:10 -07:00
Alex Vandiver 572fbfe114 queue_processors: Pass the worker_num down into the class. 2024-05-02 14:25:10 -07:00
Alex Vandiver 952291e712 migrations: Clean up non one-to-one confirmations/invites.
These models should be one-to-one.  Various bugs in the past have
leaked violations in both directions; we clean them up such that every
PreregistrationUser which is not a multi-use invite has exactly one
Confirmation object associated with it.

Fixes: #22025
2024-05-02 14:23:04 -07:00
Alex Vandiver 594e2823a7 invites: Use transactions more consistently. 2024-05-02 14:23:04 -07:00
Alex Vandiver 9dfaa83aa8 invites: Remove invites worker, make confirmation object in-process.
The "invites" worker exists to do two things -- make a Confirmation
object, and send the outgoing email.  Making the Confirmation object
in a background process from where the PreregistrationUser is created
temporarily leaves the PreregistrationUser in invalid state, and
results in 500's, and the user not immediately seeing the sent
invitation.  That the "invites" worker also wants to create the
Confirmation object means that "resending" an invite invalidates the
URL in the previous email, which can be confusing to the user.

Moving the Confirmation creation to the same transaction solves both
of these issues, and leaves the "invites" worker with nothing to do
but send the email; as such, we remove it entirely, and use the
existing "email_senders" worker to send the invites.  The volume of
invites is small enough that this will not affect other uses of that
worker.

Fixes: #21306
Fixes: #24275
2024-05-02 14:23:04 -07:00
Alex Vandiver 512d53d01a invites: Stop adjusting invited_at on resends. 2024-05-02 14:23:04 -07:00
Alex Vandiver d863aa56de invites: Lock the realm when determining invitation counts.
This prevents users from hammering the invitation endpoint, causing
races, and inviting more users than they should otherwise be allowed
to.

Doing this requires that we not raise InvitationError when we have
partially succeeded; that behaviour is left to the one callsite of
do_invite_users.

Reported by Lakshit Agarwal (@chiekosec).
2024-05-02 14:23:04 -07:00
Alex Vandiver eef5d22944 invites: Make notify_invites_changed transaction-safe. 2024-05-02 14:23:04 -07:00
Alex Vandiver e48d5e4ad2 invites: Split out some functions from zerver.actions.invites.
This will avoid a circular dependency in future commits.
2024-05-02 14:23:04 -07:00
Prakhar Pratyush b17a006bf0 data_import: Remove gitter data import tool.
Gitter broke their older API as part of being integrated
into Matrix.

Their announcement blog says:
"Anything left using the Gitter APIs will need to be
updated to use the Matrix API"

This commit drops the legacy Gitter import tool and
we plan to build a new one for Matrix in future.
2024-05-02 13:25:25 -07:00
Tim Abbott d1921aed26 zulip_updates: Fix typo. 2024-04-30 18:13:18 -07:00
Alya Abbott 89717e767f updates: Add update message (level=3). 2024-04-30 17:53:44 -07:00