Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

realm: Add support to change enable_read_receipts setting.

Sahil Batra13e0311ef3eb
diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md
index c8387e7bf39..4e3ebba48a0 100644
--- a/templates/zerver/api/changelog.md
+++ b/templates/zerver/api/changelog.md
@@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 6.0
+**Feature level 137**
+
+* [`POST /register`](/api/register-queue), [`GET
+ /events`](/api/get-events), `PATCH /realm`: Added new
+ `enable_read_receipts` realm setting.
+
**Feature level 136**
* [`PATCH /streams/{stream_id}`](/api/update-stream): The endpoint
diff --git a/version.py b/version.py
index a2eb6294fec..1bf81ae2389 100644
--- a/version.py
+++ b/version.py
@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md, as well as
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
-API_FEATURE_LEVEL = 136
+API_FEATURE_LEVEL = 137
# 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
diff --git a/zerver/models.py b/zerver/models.py
index 4efe9ef0dd3..f29d2b7f509 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -707,6 +707,7 @@ class Realm(models.Model):
email_address_visibility=int,
email_changes_disabled=bool,
emails_restricted_to_domains=bool,
+ enable_read_receipts=bool,
enable_spectator_access=bool,
giphy_rating=int,
inline_image_preview=bool,
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index a58bc3052ca..54b21449e03 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -4178,6 +4178,16 @@ paths:
[permission-level]: /api/roles-and-permissions#permission-levels
[calc-full-member]: /api/roles-and-permissions#determining-if-a-user-is-a-full-member
+ enable_read_receipts:
+ type: boolean
+ description: |
+ Whether read receipts is enabled in the organization or not.
+
+ If disabled, read receipt data will be unavailable to clients, regardless
+ of individual users' personal read receipt settings. See also the
+ `send_read_receipts` setting within `realm_user_settings_defaults`.
+
+ **Changes**: New in Zulip 6.0 (feature level 137).
additionalProperties: false
example:
{
@@ -11498,6 +11508,18 @@ paths:
**Changes**: New in Zulip 3.0 (feature level 11). Previously this
value was hardcoded to 86400 seconds (1 day).
+ realm_enable_read_receipts:
+ type: boolean
+ description: |
+ Present if `realm` is present in `fetch_event_types`.
+
+ Whether read receipts is enabled in the organization or not.
+
+ If disabled, read receipt data will be unavailable to clients, regardless
+ of individual users' personal read receipt settings. See also the
+ `send_read_receipts` setting within `realm_user_settings_defaults`.
+
+ **Changes**: New in Zulip 6.0 (feature level 137).
realm_icon_url:
type: string
description: |
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index b1e376c022f..f47a7553e21 100644
--- a/zerver/tests/test_home.py
+++ b/zerver/tests/test_home.py
@@ -139,6 +139,7 @@ class HomeTest(ZulipTestCase):
"realm_emails_restricted_to_domains",
"realm_embedded_bots",
"realm_emoji",
+ "realm_enable_read_receipts",
"realm_enable_spectator_access",
"realm_filters",
"realm_giphy_rating",
diff --git a/zerver/views/realm.py b/zerver/views/realm.py
index 2efb690655b..56e102c8f0f 100644
--- a/zerver/views/realm.py
+++ b/zerver/views/realm.py
@@ -146,6 +146,7 @@ def update_realm(
want_advertise_in_communities_directory: Optional[bool] = REQ(
json_validator=check_bool, default=None
),
+ enable_read_receipts: Optional[bool] = REQ(json_validator=check_bool, default=None),
) -> HttpResponse:
realm = user_profile.realm