From 134058b06d98420fa4adc5c5d24eecee6ba24428 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Tue, 13 Jun 2023 19:34:20 +0530 Subject: [PATCH] settings: Configure 'enable_followed_topic_audible_notifications'. This commit makes it possible for users to control the audible desktop notifications for messages sent to followed topics via a global notification setting. There is no support for configuring this setting through the UI yet. --- api_docs/changelog.md | 5 +++-- zerver/models.py | 1 + zerver/openapi/zulip.yaml | 30 ++++++++++++++++++++++++++++++ zerver/views/realm.py | 3 +++ zerver/views/user_settings.py | 3 +++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/api_docs/changelog.md b/api_docs/changelog.md index ce83d97b1a..f826955702 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -25,8 +25,9 @@ format used by the Zulip server that they are interacting with. * [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults), [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings): Added `enable_followed_topic_email_notifications`, `enable_followed_topic_push_notifications` - , `enable_followed_topic_wildcard_mentions_notify` and `enable_followed_topic_desktop_notifications` - boolean fields to control email, push, wildcard mention, and visual desktop notifications, respectively, + , `enable_followed_topic_wildcard_mentions_notify`, `enable_followed_topic_desktop_notifications` + and `enable_followed_topic_audible_notifications` boolean fields to control email, + push, wildcard mention, visual desktop and audible desktop notifications, respectively, for messages sent to followed topics. **Feature level 188** diff --git a/zerver/models.py b/zerver/models.py index 4aa2e06eb5..5197a317ab 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1726,6 +1726,7 @@ class UserBaseSettings(models.Model): enable_followed_topic_desktop_notifications=bool, enable_followed_topic_email_notifications=bool, enable_followed_topic_push_notifications=bool, + enable_followed_topic_audible_notifications=bool, enable_followed_topic_wildcard_mentions_notify=bool, ) diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 90a175658b..ee6755b412 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -9771,6 +9771,15 @@ paths: description: | Enable push notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). + schema: + type: boolean + example: false + - name: enable_followed_topic_audible_notifications + in: query + description: | + Enable audible desktop notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). schema: type: boolean @@ -11894,6 +11903,12 @@ paths: description: | Enable push notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). + enable_followed_topic_audible_notifications: + type: boolean + description: | + Enable audible desktop notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). email_notifications_batching_period_seconds: type: integer @@ -13979,6 +13994,12 @@ paths: description: | Enable push notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). + enable_followed_topic_audible_notifications: + type: boolean + description: | + Enable audible desktop notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). enable_digest_emails: type: boolean @@ -15143,6 +15164,15 @@ paths: description: | Enable push notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). + schema: + type: boolean + example: false + - name: enable_followed_topic_audible_notifications + in: query + description: | + Enable audible desktop notifications for messages sent to followed topics. + **Changes**: New in Zulip 8.0 (feature level 189). schema: type: boolean diff --git a/zerver/views/realm.py b/zerver/views/realm.py index 1c05fe54f7..066cf21491 100644 --- a/zerver/views/realm.py +++ b/zerver/views/realm.py @@ -435,6 +435,9 @@ def update_realm_user_settings_defaults( enable_followed_topic_push_notifications: Optional[bool] = REQ( json_validator=check_bool, default=None ), + enable_followed_topic_audible_notifications: Optional[bool] = REQ( + json_validator=check_bool, default=None + ), enable_followed_topic_wildcard_mentions_notify: Optional[bool] = REQ( json_validator=check_bool, default=None ), diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py index 824ee5df8c..7073a8151f 100644 --- a/zerver/views/user_settings.py +++ b/zerver/views/user_settings.py @@ -202,6 +202,9 @@ def json_change_settings( enable_followed_topic_push_notifications: Optional[bool] = REQ( json_validator=check_bool, default=None ), + enable_followed_topic_audible_notifications: Optional[bool] = REQ( + json_validator=check_bool, default=None + ), enable_followed_topic_wildcard_mentions_notify: Optional[bool] = REQ( json_validator=check_bool, default=None ),