Commit Graph

18092 Commits

Author SHA1 Message Date
Lauryn Menard 9be4d07442 i18n: Update translated errors for stream to channel rename.
Updates various areas of the backend code that generate
JsonableErrors with translated strings to use channel
instead of stream.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard df3ab8deea invites: Update translated errors for stream to channel rename.
In zerver/views/invite.py, updates translated errors strings to
use channel instead of stream.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 9aaddc6231 stream-policy: Update everyone policy for stream to channel rename.
In zerver/models/streams.py, updates translated string for when everyone
can post to a stream/channel to use channel instead of stream.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard eb9a142a9e stream-events: Update topic name for stream to channel rename.
In zerver/models/realms.py, updates the topic for stream/channel updates
to be "channel events" instead of "stream events".

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 9b46204fad onboarding: Update new org welcome msgs for stream to channel rename.
Updates the translated strings in the messages sent by the welcome
bot in new Zulip organizations to use channel instead of stream.

Comments out part of a test that uses translated Italian strings
to check these welcome bot messages and adds a TODO comment to
note that the test code should be uncommented when those strings
are translated for the stream -> channel rename.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 3f79fd0f10 hotspots: Update "intro_streams" text for stream to channel rename.
Updates the "intro_streams" hotspot translated strings to use
channel instead of stream.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 0b5f325e48 exceptions: Update translated errors for stream to channel rename.
In zerver/lib/exceptions.py, updates translated error strings
to use channel instead of stream.

Note that the STREAM_WILDCARD_MENTION_NOT_ALLOWED and the
STREAM_DOES_NOT_EXIST error codes, and any additional fields
included with those errors, are not changed in these updates.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 51b3ef8ee3 streams-events: Update notifications for stream to channel rename.
Updates notification messages that are sent to "stream events"
topic when a permission or policy setting is changed to use channel
instead of stream. Also, updates some strings that were not marked
for translation in the message that was sent when the retention
policy was changed.

Updates notification messages that are sent when a stream/channel
is created.

Updates notification messages that are sent when a user is
subscribed to stream/channel(s).

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 91ffb548cc streams: Update translated errors for stream to channel rename.
Updates translated JsonableError strings that relate to streams
to use channel instead of stream. Separated from other error string
updates as this is a dense area of changes for this rename.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard c1f1dc4b25 message-send: Update translated errors for stream to channel rename.
In zerver/actions/message_send.py, updates translated error strings
to use channel instead of stream.

Also, updates the messages sent to bot owners when a stream doesn't
exist or has no subscribers.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard acb54a8bc5 emails: Update context/content for stream to channel rename.
In the missed message email, updates "stream_name" context variable
to be "channel_name". This varible is part of some translated
strings in the email's content.

In onboarding zulip topics email, updates content references to
streams to use channels instead for translated strings. Also,
updates "move_topic_to_different_stream_link" context variable to
be "move_channels_link".

Does not yet update the image used in the onboarding topics email
as that will be updated as part of the help center changes for
this rename.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard 20f4022391 email-digest: Update translated strings for stream to channel rename.
Updates the translated "New streams" string in the email digest to
instead by "New channels". Also, marks that for translation in the
plain text version of the email.

Updates the generated stream/channel url to use stream_narrow_url
in preparation for updating stream narrow urls for the rename.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Lauryn Menard abc6f5b8a2 i18n: Update translated string variables for stream to channel rename.
Generally updates variables that appear in translated strings that use
"stream" to instead use "channel".

Two exceptions are ErrorCode.STREAM_DOES_NOT_EXIST JsonableErrors as
changing the variable would also change the fields returned by these
errors to clients.

Changes to context variables in emails and variables in onboarding
welcome bot messages are addressed in separate commits.

Part of stream to channel rename project.
2024-04-24 14:35:05 -07:00
Alex Vandiver 6418d86763 migrations: Switch to AddIndexConcurrently. 2024-04-24 08:56:17 -07:00
Alya Abbott 363ea09710 help: Change "Via compose box buttons" tab label to use the singular. 2024-04-23 09:57:27 -07:00
Sayam Samal 19a7dae8aa docs: Update the gear menu icon.
This commit updates the /help and /api docs to reflect the new gear
menu icon introduced in bc3d486.
2024-04-23 09:24:02 -07:00
Lauryn Menard b45c5a30c8 api-docs: Update API feature level 249 documentation.
Updates the API changelog entry and changes notes for feature level
249 to match other API updates to narrow filters, and links to the
help center article on emoji reactions in these notes.

Feature level 249 changes were originally in commit c3408b56f0.
2024-04-22 09:27:39 -07:00
Kenneth Rodrigues 081119f461 push-notifications: Migrate to typed endpoint. 2024-04-21 11:09:32 -07:00
Kenneth Rodrigues d03659ee1c read-receipts: Migrate to typed endpoint. 2024-04-21 11:09:32 -07:00
Kenneth Rodrigues 6704faf3cd reactions: Migrate to typed_endpoint. 2024-04-21 11:09:32 -07:00
Lauryn Menard c0be6c6b98 api-docs: Clean up feature level 233 and 230 documentation.
Updates the API changelog entries and changes notes for feature
levels 233 and 230, which both are related to the onboarding
steps (hotspots and one-time notices) updates.

Feature level 233 was originally documented in commit 83bd9955e3
and ac8af3d6de.

Feature level 230 was originally documented in commit 8d633cc36.
2024-04-21 11:07:18 -07:00
Lauryn Menard 02e98f7fa2 api-docs: Tweak newly documented invites endpoints documentation.
Makes a few small tweaks on the newly documented invites endpoints
for current API documentation conventions that were missed in the
review process.
2024-04-21 11:04:35 -07:00
Lauryn Menard cc5b846410 api-docs: Make small clean-ups to feature level 254 updates.
Updates the changelog entry to use "ID" instead of "id".

Revises text for "null" value to match other field descriptions
in these stream/subscription objects.
2024-04-21 11:03:39 -07:00
tnmkr 5128d8f9af streams: Add creator field.
Adds nullable creator field, containing a reference to the user who
created the stream. When creating a stream, acting user is set as
the creator of the stream. Since API calls to create streams always
have an acting user, this field should always be set when streams
are created using the API.

Because streams can be created with no acting user, this field is
nullable. We try to backfill existing streams using RealmAuditLog table,
but not all streams are guaranteed to have a recorded create log. Thus
this new field is left null when it cannot be backfilled. We also set
this field to null when the creator user is deleted.
2024-04-20 19:03:43 -07:00
Tim Abbott 9fa7f71125 import_realm: Include UserProfile in early update_model_ids. 2024-04-20 19:03:43 -07:00
Vector73 0f97733687 api_documentation: Document "/invites/{prereg_id}" endpoint. 2024-04-20 18:12:04 -07:00
Kenneth Rodrigues 5db24e002c narrow-parameter: Add validation for the narrow parameters. 2024-04-20 09:04:26 -07:00
Kenneth Rodrigues def2d402f4 message-flags: Migrate message flag endpoints to typed_endpoint. 2024-04-20 09:04:26 -07:00
Lauryn Menard 1d5897060a audit-logs: Add index to RealmAuditLog for realm and event type.
Adds an index on RealmAuditLog for the realm, event_type, and
event_time in order to improve database queries on these audit logs.

tabbott verified using EXPLAIN ANALYZE that this also considerably
speeds up queries that order by ID rather than event_time, but
event_time is how these should be ordered given the possibility of
backfills.
2024-04-19 17:58:59 -07:00
Mateusz Mandera 962ab13203 push_notifs: Make push_notifications_enabled more resistant to flapping.
Fixes #28403

Uses redis to remember the last time push notifications were experienced
working. This needs to work across processes, so can't be done just in
memory.
As this is transient data that's fairly harmless to lose and thus
doesn't require the persistence benefits of the database, and we're
keeping a single "row", so don't need an entire new db table, we settle
on using redis instead of postgres. This is also consistent with how we
store other kinds of such transient data.
2024-04-19 10:25:34 -07:00
Mateusz Mandera 630335142a rate_limiter: Extract KEY_PREFIX to redis_utils. 2024-04-19 10:25:34 -07:00
Ujjawal Modi 706c380971 audit_log: Update audit log entries created while creating a group.
Earlier a extra audit log entry of type
USER_GROUP_GROUP_BASED_SETTING_CHANGED was made when a new user
group is created. This commit updates the code to not create
that audit log entry.

There is no need to create these entry as we would still
have the required data from the "OLD_VALUE" field in the
audit log entry created when changing the setting and this
also makes it consistent with the entries created for
other operations like stream creation.
2024-04-19 10:18:45 -07:00
Prakhar Pratyush 6ae7ed580e api_docs: Fix the example JSON error response for 'POST /typing'.
In 5e30ab91b9, we introduced
'stream_id' parameter. 'to' is no longer used when composing
stream messages to specify the stream ID.

Earlier, 'to' parameter accepted a single element list
containing the ID of the stream.

Since we can't specify multiple stream IDs anymore, the
example JSON error response documented is stale.

This commit updates that.
2024-04-19 09:54:54 -07:00
Tim Abbott 342a9bd5cd zulip_updates: Prevent racing with self using a lock. 2024-04-18 15:14:02 -07:00
Tim Abbott 5c5e6b8cc5 zulip_updates: Protect against race with ourself. 2024-04-18 15:14:02 -07:00
Tim Abbott 5565bcf64f zulip_updates: Don't run Markdown inside a transaction.
This isn't safe because of the use of unsafe_timeout in this code
path.
2024-04-18 15:14:02 -07:00
Anders Kaseorg 3b4527843d requirements: Upgrade Django to 5.0.5.dev.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-18 12:39:47 -07:00
Anders Kaseorg 72018cc26b timeout: Rename to unsafe_timeout.
This timeout strategy using asynchronous exceptions has a number of
safety caveats (read the docstring!!) and should only be used in very
specific circumstances.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-18 11:50:38 -07:00
Anders Kaseorg 631c2f7d4c test_helpers: Remove unused timeout_mock.
We don’t want to encourage more uses of zerver.lib.timeout.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-18 11:50:38 -07:00
Anders Kaseorg da979bc65c streams: Remove inappropriate use of zerver.lib.timeout.
zerver.lib.timeout abuses asynchronous exceptions, so it’s only safe
to use on CPU computations with no side effects.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-18 11:50:38 -07:00
Anders Kaseorg 95a1481f99 message_flags: Remove inappropriate use of zerver.lib.timeout.
zerver.lib.timeout abuses asynchronous exceptions, so it’s only safe
to use on CPU computations with no side effects.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-18 11:50:38 -07:00
Anders Kaseorg 72aeaf8d52 db: Split reset_queries into a new module zerver.lib.db_connections.
Fixes an import cycle that breaks mypy inference with django-stubs:

zproject.settings → zproject.computed_settings → zerver.lib.db →
django.db → django.db.backends.base.base →
django.db.backends.base.features → django.db.models.base →
django.db.models.options → django.contrib.contenttypes.fields →
django.contrib.contenttypes.models → confirmation.models → django.conf
→ zproject.settings

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-17 16:49:03 -07:00
Kislay Verma 245357c868 stream_settings_ui: Go to newly created stream.
- On creating a stream, the user is redirected to the
 "stream events" topic of the newly created stream.
- If this is the first time the user has created a stream,
an explanatory modal is shown.

test_hotspots.py is modified to account for the new addition
of the first_stream_created_banner.

stream_create.test.ts is also modified accordingly.

Fixes #29375.
2024-04-17 15:35:19 -07:00
Mahhheshh d82f33a3c8 zilencer: Migrate to `@typed_endpoint`.
migrated views:
- `zilencer.views.register_remote_server`
- `zilencer.views.register_remote_push_device`
- `zilencer.views.unregister_remote_push_device`
- `zilencer.views.unregister_all_remote_push_devices`
- `zilencer.views.remote_server_notify_push`

to make sure the previous checks for `remote_server_notify_push` matches
to old one, The `RemoteServerNotificationPayload` is defined.
2024-04-17 13:45:54 -07:00
Tim Abbott 2c62152a8b left-sidebar: Rename "All direct messages" => "Direct message feed".
This aligns with the new naming scheme for other left sidebar
elements.
2024-04-17 12:42:21 -07:00
nimishmedatwal 1594011b67 left_sidebar: Rename All messages to Global Feed.
Fixes part of #27802.
2024-04-17 12:42:21 -07:00
Anders Kaseorg f31579a220 python: Avoid relying on Collection supertype of QuerySet.
QuerySet doesn’t implement __contains__, so it can’t be a subtype of
Container or Collection (https://code.djangoproject.com/ticket/35154).
This incorrect subtyping annotation was removed in
https://github.com/typeddjango/django-stubs/pull/1925, so we need to
stop relying on it before upgrading to django-stubs 5.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-16 23:02:16 -07:00
Alex Vandiver 5654d051f7 worker: Split into separate files.
This makes each worker faster to start up.
2024-04-16 23:00:02 -07:00
Alex Vandiver db86027cbd migrations: Add a migration to fix emoji metadata in S3.
bcd179be0e fixed this for recent imports, but did not address
imports from before it was merged.
2024-04-16 17:13:06 -07:00
Anders Kaseorg b64bf2d425 test_console_output: Mark regexes as raw strings.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-16 14:51:39 -07:00