user_settings: Add send_read_receipts setting.

This will be useful to let users enable/disable
sharing read receipts once we add that feature.

Note: Added "I've" to IGNORED_PHRASES in
tools/lib/capitalization.py to avoid capitalization
errors for the label text of this setting.
This commit is contained in:
Dinesh 2021-10-03 12:23:35 +05:30 committed by Tim Abbott
parent b41918e74e
commit e2df0d171f
11 changed files with 77 additions and 7 deletions

View File

@ -585,6 +585,7 @@ export function dispatch_normal_event(event) {
"starred_message_counts", "starred_message_counts",
"send_stream_typing_notifications", "send_stream_typing_notifications",
"send_private_typing_notifications", "send_private_typing_notifications",
"send_read_receipts",
]; ];
if (user_display_settings.includes(event.property)) { if (user_display_settings.includes(event.property)) {

View File

@ -54,6 +54,9 @@ function setup_settings_label() {
send_private_typing_notifications: $t({ send_private_typing_notifications: $t({
defaultMessage: "Let recipients see when I'm typing private messages", 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.notification_settings_labels,
...settings_config.display_settings_labels, ...settings_config.display_settings_labels,

View File

@ -35,6 +35,7 @@ export type UserSettingsType = {
wildcard_mentions_notify: boolean; wildcard_mentions_notify: boolean;
send_stream_typing_notifications: boolean; send_stream_typing_notifications: boolean;
send_private_typing_notifications: boolean; send_private_typing_notifications: boolean;
send_read_receipts: boolean;
}; };
export let user_settings = {} as UserSettingsType; export let user_settings = {} as UserSettingsType;

View File

@ -116,6 +116,11 @@
is_checked=settings_object.send_stream_typing_notifications is_checked=settings_object.send_stream_typing_notifications
label=settings_label.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}} {{/if}}
</div> </div>
</div> </div>

View File

@ -16,12 +16,8 @@ below features are supported.
* [`POST /register`](/api/register-queue), [`PATCH * [`POST /register`](/api/register-queue), [`PATCH
/settings`](/api/update-settings), [`PATCH /settings`](/api/update-settings), [`PATCH
/realm/user_settings_defaults`](/api/update-realm-user-settings-defaults): /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults):
Added two new settings: `send_private_typing_notifications` controls Added three new privacy settings: `send_private_typing_notifications`,
whether clients should send typing notifications when composing `send_stream_typing_notifications`, and `send_read_receipts`.
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.
**Feature level 104** **Feature level 104**

View File

@ -75,6 +75,7 @@ IGNORED_PHRASES = [
r"I say", r"I say",
r"I want", r"I want",
r"I'm", r"I'm",
r"I've",
# Specific short words # Specific short words
r"beta", r"beta",
r"and", r"and",

View File

@ -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),
),
]

View File

@ -1439,6 +1439,7 @@ class UserBaseSettings(models.Model):
# Privacy settings # Privacy settings
send_stream_typing_notifications: bool = models.BooleanField(default=True) send_stream_typing_notifications: bool = models.BooleanField(default=True)
send_private_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( display_settings_legacy = dict(
color_scheme=int, color_scheme=int,
@ -1492,6 +1493,7 @@ class UserBaseSettings(models.Model):
# Add new general settings here. # Add new general settings here.
send_stream_typing_notifications=bool, send_stream_typing_notifications=bool,
send_private_typing_notifications=bool, send_private_typing_notifications=bool,
send_read_receipts=bool,
), ),
} }

View File

@ -7880,6 +7880,16 @@ paths:
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
stream messages. 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). **Changes**: New in Zulip 5.0 (feature level 105).
schema: schema:
type: boolean type: boolean
@ -9759,6 +9769,13 @@ paths:
when composing stream messages. The client should send typing when composing stream messages. The client should send typing
notifications for stream messages if and only if this setting is enabled. 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). **Changes**: New in Zulip 5.0 (feature level 105).
has_zoom_token: has_zoom_token:
type: boolean type: boolean
@ -11427,6 +11444,13 @@ paths:
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
stream messages. 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). **Changes**: New in Zulip 5.0 (feature level 105).
realm_users: realm_users:
type: array type: array
@ -12477,6 +12501,16 @@ paths:
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
stream messages. 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). **Changes**: New in Zulip 5.0 (feature level 105).
schema: schema:
type: boolean type: boolean

View File

@ -396,7 +396,10 @@ def update_realm_user_settings_defaults(
), ),
twenty_four_hour_time: Optional[bool] = REQ(json_validator=check_bool, default=None), 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_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: ) -> HttpResponse:
if notification_sound is not None or email_notifications_batching_period_seconds is not None: 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) check_settings_values(notification_sound, email_notifications_batching_period_seconds)

View File

@ -193,6 +193,7 @@ def json_change_settings(
json_validator=check_bool, default=None json_validator=check_bool, default=None
), ),
send_stream_typing_notifications: Optional[bool] = REQ(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: ) -> HttpResponse:
if ( if (
default_language is not None default_language is not None