mirror of https://github.com/zulip/zulip.git
user_settings: Add settings to configure sending typing notifications.
Note: These are not functional in enabling/disabling sending of typing notifications with this commit. Refactored the privacy settings update to keep the code less duplicated along with making the addition of new settings easier.
This commit is contained in:
parent
0b68f264c6
commit
6d2b8f5ca9
|
@ -583,6 +583,8 @@ export function dispatch_normal_event(event) {
|
||||||
"twenty_four_hour_time",
|
"twenty_four_hour_time",
|
||||||
"translate_emoticons",
|
"translate_emoticons",
|
||||||
"starred_message_counts",
|
"starred_message_counts",
|
||||||
|
"send_stream_typing_notifications",
|
||||||
|
"send_private_typing_notifications",
|
||||||
];
|
];
|
||||||
|
|
||||||
if (user_display_settings.includes(event.property)) {
|
if (user_display_settings.includes(event.property)) {
|
||||||
|
|
|
@ -48,6 +48,12 @@ function setup_settings_label() {
|
||||||
presence_enabled: $t({
|
presence_enabled: $t({
|
||||||
defaultMessage: "Display my availability to other users when online",
|
defaultMessage: "Display my availability to other users when online",
|
||||||
}),
|
}),
|
||||||
|
send_stream_typing_notifications: $t({
|
||||||
|
defaultMessage: "Let subscribers see when I'm typing messages in streams",
|
||||||
|
}),
|
||||||
|
send_private_typing_notifications: $t({
|
||||||
|
defaultMessage: "Let recipients see when I'm typing private messages",
|
||||||
|
}),
|
||||||
|
|
||||||
...settings_config.notification_settings_labels,
|
...settings_config.notification_settings_labels,
|
||||||
...settings_config.display_settings_labels,
|
...settings_config.display_settings_labels,
|
||||||
|
|
|
@ -682,11 +682,15 @@ export function set_up() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#user_presence_enabled").on("change", (e) => {
|
$("#privacy_settings_box").on("change", "input", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
const data = {presence_enabled: $("#user_presence_enabled").prop("checked")};
|
const input_elem = $(e.currentTarget);
|
||||||
|
const setting_name = input_elem.attr("name");
|
||||||
|
const checked = input_elem.prop("checked");
|
||||||
|
|
||||||
|
const data = {[setting_name]: checked};
|
||||||
settings_ui.do_settings_change(
|
settings_ui.do_settings_change(
|
||||||
channel.patch,
|
channel.patch,
|
||||||
"/json/settings",
|
"/json/settings",
|
||||||
|
|
|
@ -33,6 +33,8 @@ export type UserSettingsType = {
|
||||||
translate_emoticons: boolean;
|
translate_emoticons: boolean;
|
||||||
twenty_four_hour_time: boolean;
|
twenty_four_hour_time: boolean;
|
||||||
wildcard_mentions_notify: boolean;
|
wildcard_mentions_notify: boolean;
|
||||||
|
send_stream_typing_notifications: boolean;
|
||||||
|
send_private_typing_notifications: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let user_settings = {} as UserSettingsType;
|
export let user_settings = {} as UserSettingsType;
|
||||||
|
|
|
@ -105,6 +105,18 @@
|
||||||
label=settings_label.presence_enabled
|
label=settings_label.presence_enabled
|
||||||
help_link="/help/status-and-availability"
|
help_link="/help/status-and-availability"
|
||||||
prefix="user_"}}
|
prefix="user_"}}
|
||||||
|
{{> settings_checkbox
|
||||||
|
setting_name="send_private_typing_notifications"
|
||||||
|
is_checked=settings_object.send_private_typing_notifications
|
||||||
|
label=settings_label.send_private_typing_notifications
|
||||||
|
}}
|
||||||
|
{{#if page_params.development_environment }}
|
||||||
|
{{> settings_checkbox
|
||||||
|
setting_name="send_stream_typing_notifications"
|
||||||
|
is_checked=settings_object.send_stream_typing_notifications
|
||||||
|
label=settings_label.send_stream_typing_notifications
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,18 @@ below features are supported.
|
||||||
|
|
||||||
## Changes in Zulip 5.0
|
## Changes in Zulip 5.0
|
||||||
|
|
||||||
|
**Feature level 105**
|
||||||
|
|
||||||
|
* [`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.
|
||||||
|
|
||||||
**Feature level 104**
|
**Feature level 104**
|
||||||
|
|
||||||
* [`PATCH /realm`]: Added `string_id` parameter for changing an
|
* [`PATCH /realm`]: Added `string_id` parameter for changing an
|
||||||
|
|
|
@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
|
||||||
# Changes should be accompanied by documentation explaining what the
|
# Changes should be accompanied by documentation explaining what the
|
||||||
# new level means in templates/zerver/api/changelog.md, as well as
|
# new level means in templates/zerver/api/changelog.md, as well as
|
||||||
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
|
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
|
||||||
API_FEATURE_LEVEL = 104
|
API_FEATURE_LEVEL = 105
|
||||||
|
|
||||||
# Bump the minor PROVISION_VERSION to indicate that folks should provision
|
# Bump the minor PROVISION_VERSION to indicate that folks should provision
|
||||||
# only when going from an old version of the code to a newer version. Bump
|
# only when going from an old version of the code to a newer version. Bump
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Generated by Django 3.2.7 on 2021-10-03 07:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("zerver", "0361_realm_create_web_public_stream_policy"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="realmuserdefault",
|
||||||
|
name="send_private_typing_notifications",
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="realmuserdefault",
|
||||||
|
name="send_stream_typing_notifications",
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="send_private_typing_notifications",
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="send_stream_typing_notifications",
|
||||||
|
field=models.BooleanField(default=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1436,6 +1436,10 @@ class UserBaseSettings(models.Model):
|
||||||
# Whether or not the user wants to sync their drafts.
|
# Whether or not the user wants to sync their drafts.
|
||||||
enable_drafts_synchronization = models.BooleanField(default=True)
|
enable_drafts_synchronization = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
# Privacy settings
|
||||||
|
send_stream_typing_notifications: bool = models.BooleanField(default=True)
|
||||||
|
send_private_typing_notifications: bool = models.BooleanField(default=True)
|
||||||
|
|
||||||
display_settings_legacy = dict(
|
display_settings_legacy = dict(
|
||||||
color_scheme=int,
|
color_scheme=int,
|
||||||
default_language=str,
|
default_language=str,
|
||||||
|
@ -1481,7 +1485,15 @@ class UserBaseSettings(models.Model):
|
||||||
} # Add new notifications settings here.
|
} # Add new notifications settings here.
|
||||||
|
|
||||||
# Define the types of the various automatically managed properties
|
# Define the types of the various automatically managed properties
|
||||||
property_types = {**display_settings_legacy, **notification_setting_types}
|
property_types = {
|
||||||
|
**display_settings_legacy,
|
||||||
|
**notification_setting_types,
|
||||||
|
**dict(
|
||||||
|
# Add new general settings here.
|
||||||
|
send_stream_typing_notifications=bool,
|
||||||
|
send_private_typing_notifications=bool,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
|
@ -7864,6 +7864,26 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
example: true
|
example: true
|
||||||
|
- name: send_private_typing_notifications
|
||||||
|
in: query
|
||||||
|
description: |
|
||||||
|
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
|
||||||
|
private messages.
|
||||||
|
|
||||||
|
**Changes**: New in Zulip 5.0 (feature level 105).
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
|
- name: send_stream_typing_notifications
|
||||||
|
in: query
|
||||||
|
description: |
|
||||||
|
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
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Success
|
description: Success
|
||||||
|
@ -9722,6 +9742,24 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
The text describing the emoji set.
|
The text describing the emoji set.
|
||||||
|
send_private_typing_notifications:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Whether the user has chosen to send [typing
|
||||||
|
notifications](/help/status-and-availability#typing-notifications)
|
||||||
|
when composing private messages. The client should send typing
|
||||||
|
notifications for private messages if and only if this setting is enabled.
|
||||||
|
|
||||||
|
**Changes**: New in Zulip 5.0 (feature level 105).
|
||||||
|
send_stream_typing_notifications:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Whether the user has chosen to send [typing
|
||||||
|
notifications](/help/status-and-availability#typing-notifications)
|
||||||
|
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).
|
||||||
has_zoom_token:
|
has_zoom_token:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: |
|
description: |
|
||||||
|
@ -11376,6 +11414,20 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
The text describing the emoji set.
|
The text describing the emoji set.
|
||||||
|
send_private_typing_notifications:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
|
||||||
|
private messages.
|
||||||
|
|
||||||
|
**Changes**: New in Zulip 5.0 (feature level 105).
|
||||||
|
send_stream_typing_notifications:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
|
||||||
|
stream messages.
|
||||||
|
|
||||||
|
**Changes**: New in Zulip 5.0 (feature level 105).
|
||||||
realm_users:
|
realm_users:
|
||||||
type: array
|
type: array
|
||||||
description: |
|
description: |
|
||||||
|
@ -12409,6 +12461,26 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
example: true
|
example: true
|
||||||
|
- name: send_private_typing_notifications
|
||||||
|
in: query
|
||||||
|
description: |
|
||||||
|
Whether [typing notifications](/help/status-and-availability#typing-notifications) be sent when composing
|
||||||
|
private messages.
|
||||||
|
|
||||||
|
**Changes**: New in Zulip 5.0 (feature level 105).
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
|
- name: send_stream_typing_notifications
|
||||||
|
in: query
|
||||||
|
description: |
|
||||||
|
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
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Success
|
description: Success
|
||||||
|
|
|
@ -395,6 +395,8 @@ def update_realm_user_settings_defaults(
|
||||||
json_validator=check_int, default=None
|
json_validator=check_int, default=None
|
||||||
),
|
),
|
||||||
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_private_typing_notifications: 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)
|
||||||
|
|
|
@ -189,6 +189,10 @@ def json_change_settings(
|
||||||
realm_name_in_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
realm_name_in_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
||||||
presence_enabled: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
presence_enabled: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
||||||
enter_sends: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
enter_sends: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
||||||
|
send_private_typing_notifications: Optional[bool] = REQ(
|
||||||
|
json_validator=check_bool, default=None
|
||||||
|
),
|
||||||
|
send_stream_typing_notifications: Optional[bool] = REQ(json_validator=check_bool, default=None),
|
||||||
) -> HttpResponse:
|
) -> HttpResponse:
|
||||||
if (
|
if (
|
||||||
default_language is not None
|
default_language is not None
|
||||||
|
|
Loading…
Reference in New Issue