diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index 1905cc0b9e..54ffd4eb24 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -585,6 +585,7 @@ export function dispatch_normal_event(event) { "starred_message_counts", "send_stream_typing_notifications", "send_private_typing_notifications", + "send_read_receipts", ]; if (user_display_settings.includes(event.property)) { diff --git a/static/js/settings.js b/static/js/settings.js index 305b502961..2712bc2305 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -54,6 +54,9 @@ function setup_settings_label() { send_private_typing_notifications: $t({ defaultMessage: "Let recipients see when I'm typing private messages", }), + send_read_receipts: $t({ + defaultMessage: "Let participants see when I've read messages", + }), ...settings_config.notification_settings_labels, ...settings_config.display_settings_labels, diff --git a/static/js/user_settings.ts b/static/js/user_settings.ts index 20832e0347..88ce89c4f5 100644 --- a/static/js/user_settings.ts +++ b/static/js/user_settings.ts @@ -35,6 +35,7 @@ export type UserSettingsType = { wildcard_mentions_notify: boolean; send_stream_typing_notifications: boolean; send_private_typing_notifications: boolean; + send_read_receipts: boolean; }; export let user_settings = {} as UserSettingsType; diff --git a/static/templates/settings/account_settings.hbs b/static/templates/settings/account_settings.hbs index 4996026746..fbeecd464c 100644 --- a/static/templates/settings/account_settings.hbs +++ b/static/templates/settings/account_settings.hbs @@ -116,6 +116,11 @@ is_checked=settings_object.send_stream_typing_notifications label=settings_label.send_stream_typing_notifications }} + {{> settings_checkbox + setting_name="send_read_receipts" + is_checked=settings_object.send_read_receipts + label=settings_label.send_read_receipts + }} {{/if}} diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md index 8103d752a4..876e1f5b9a 100644 --- a/templates/zerver/api/changelog.md +++ b/templates/zerver/api/changelog.md @@ -16,12 +16,8 @@ below features are supported. * [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings), [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults): - Added two new settings: `send_private_typing_notifications` controls - whether clients should send typing notifications when composing - private messages, and `send_stream_typing_notifications` does the - same when composing stream messages. Only - `send_private_typing_notifications` has a functional effect, as - stream-level typing notifications are not a finished feature. + Added three new privacy settings: `send_private_typing_notifications`, + `send_stream_typing_notifications`, and `send_read_receipts`. **Feature level 104** diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py index 1f1ae139e7..e146ad4a47 100644 --- a/tools/lib/capitalization.py +++ b/tools/lib/capitalization.py @@ -75,6 +75,7 @@ IGNORED_PHRASES = [ r"I say", r"I want", r"I'm", + r"I've", # Specific short words r"beta", r"and", diff --git a/zerver/migrations/0363_send_read_receipts_user_setting.py b/zerver/migrations/0363_send_read_receipts_user_setting.py new file mode 100644 index 0000000000..79b5bf41e8 --- /dev/null +++ b/zerver/migrations/0363_send_read_receipts_user_setting.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.7 on 2021-10-03 07:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("zerver", "0362_send_typing_notifications_user_setting"), + ] + + operations = [ + migrations.AddField( + model_name="realmuserdefault", + name="send_read_receipts", + field=models.BooleanField(default=True), + ), + migrations.AddField( + model_name="userprofile", + name="send_read_receipts", + field=models.BooleanField(default=True), + ), + ] diff --git a/zerver/models.py b/zerver/models.py index d06ec3a3ff..014a7b3008 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1439,6 +1439,7 @@ class UserBaseSettings(models.Model): # Privacy settings send_stream_typing_notifications: bool = models.BooleanField(default=True) send_private_typing_notifications: bool = models.BooleanField(default=True) + send_read_receipts: bool = models.BooleanField(default=True) display_settings_legacy = dict( color_scheme=int, @@ -1492,6 +1493,7 @@ class UserBaseSettings(models.Model): # Add new general settings here. send_stream_typing_notifications=bool, send_private_typing_notifications=bool, + send_read_receipts=bool, ), } diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 91d47c9634..87a8de2053 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -7880,6 +7880,16 @@ paths: Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing stream messages. + **Changes**: New in Zulip 5.0 (feature level 105). + schema: + type: boolean + example: true + - name: send_read_receipts + in: query + description: | + Whether other users are allowed to see whether you've + read messages. + **Changes**: New in Zulip 5.0 (feature level 105). schema: type: boolean @@ -9759,6 +9769,13 @@ paths: when composing stream messages. The client should send typing notifications for stream messages if and only if this setting is enabled. + **Changes**: New in Zulip 5.0 (feature level 105). + send_read_receipts: + type: boolean + description: | + Whether other users are allowed to see whether you've + read messages. + **Changes**: New in Zulip 5.0 (feature level 105). has_zoom_token: type: boolean @@ -11427,6 +11444,13 @@ paths: Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing stream messages. + **Changes**: New in Zulip 5.0 (feature level 105). + send_read_receipts: + type: boolean + description: | + Whether other users are allowed to see whether you've + read messages. + **Changes**: New in Zulip 5.0 (feature level 105). realm_users: type: array @@ -12477,6 +12501,16 @@ paths: Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing stream messages. + **Changes**: New in Zulip 5.0 (feature level 105). + schema: + type: boolean + example: true + - name: send_read_receipts + in: query + description: | + Whether other users are allowed to see whether you've + read messages. + **Changes**: New in Zulip 5.0 (feature level 105). schema: type: boolean diff --git a/zerver/views/realm.py b/zerver/views/realm.py index 0dc25e60e4..33d16fbb3a 100644 --- a/zerver/views/realm.py +++ b/zerver/views/realm.py @@ -396,7 +396,10 @@ def update_realm_user_settings_defaults( ), twenty_four_hour_time: Optional[bool] = REQ(json_validator=check_bool, default=None), send_stream_typing_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None), - send_private_typing_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None), + send_private_typing_notifications: Optional[bool] = REQ( + json_validator=check_bool, default=None + ), + send_read_receipts: Optional[bool] = REQ(json_validator=check_bool, default=None), ) -> HttpResponse: if notification_sound is not None or email_notifications_batching_period_seconds is not None: check_settings_values(notification_sound, email_notifications_batching_period_seconds) diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py index 9f51255c94..75f4c9c253 100644 --- a/zerver/views/user_settings.py +++ b/zerver/views/user_settings.py @@ -193,6 +193,7 @@ def json_change_settings( json_validator=check_bool, default=None ), send_stream_typing_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None), + send_read_receipts: Optional[bool] = REQ(json_validator=check_bool, default=None), ) -> HttpResponse: if ( default_language is not None