Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
presence: Return some presence params in the /register response.
Mateusz Manderaa593089770e0
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex ca8d8996a70..0841ada9c57 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 7.0+**Feature level 164**++* [`POST /register`](/api/register-queue) Added the+ `server_presence_ping_interval_seconds` and `server_presence_offline_threshold_seconds`+ attributes.+**Feature level 163*** [`GET /users`](/api/get-users), [`GET /users/{user_id}`](/api/get-user),diff --git a/version.py b/version.pyindex c7c537739bd..85d0cfa2e77 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 api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 163+API_FEATURE_LEVEL = 164# 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. Bumpdiff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 73fc49f84fd..4483db00a96 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -354,6 +354,10 @@ def fetch_initial_state_data(realm.demo_organization_scheduled_deletion_date)+ # Presence system parameters for client behavior.+ state["server_presence_ping_interval_seconds"] = settings.PRESENCE_PING_INTERVAL_SECS+ state["server_presence_offline_threshold_seconds"] = settings.OFFLINE_THRESHOLD_SECS+if want("realm_user_settings_defaults"):realm_user_default = RealmUserDefault.objects.get(realm=realm)state["realm_user_settings_defaults"] = {}diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex f2c7bee13d9..3afd363a04a 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -10260,6 +10260,31 @@ paths:**Changes**: New in Zulip 4.0 (feature level 53). Previously,this property always had a value of 10000.+ server_presence_ping_interval_seconds:+ type: integer+ description: |+ For clients implementing the [presence](/api/get-presence) system,+ the time interval the client should use for sending presence requests+ to the server (and thus receive presence updates from the server).++ It is important for presence implementatios to use both this and+ `server_presence_offline_threshold_seconds` correctly, so that a Zulip+ server can change these values to manage the trade-off between load and+ freshness of presence data.++ **Changes**: New in Zulip 7.0 (feature level 164). Clients should use 60+ for older Zulip servers, since that's the value that was hardcoded in the+ the Zulip mobile apps prior to this parameter being introduced.+ server_presence_offline_threshold_seconds:+ type: integer+ description: |+ How old a presence timestamp for a given user can be before the user+ should be displayed as offline by clients displaying Zulip presence+ data. See the related `server_presence_ping_interval_seconds` for details.++ **Changes**: New in Zulip 7.0 (feature level 164). Clients should use 140+ for older Zulip servers, since that's the value that was hardcoded in the+ Zulip client apps prior to this parameter being introduced.muted_topics:type: arraydeprecated: truediff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.pyindex 6296fcfab34..e67464bc7f6 100644--- a/zerver/tests/test_home.py+++ b/zerver/tests/test_home.py@@ -196,6 +196,8 @@ class HomeTest(ZulipTestCase):"server_inline_url_embed_preview","server_name_changes_disabled","server_needs_upgrade",+ "server_presence_offline_threshold_seconds",+ "server_presence_ping_interval_seconds","server_timestamp","server_web_public_streams_enabled","settings_send_digest_emails",diff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex 0894ffe2a1a..c9d4a5b14c8 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -491,6 +491,9 @@ STAGING = False# Should match the presence.js constant.OFFLINE_THRESHOLD_SECS = 140+# How often a client should ping by asking for presence data of all users.+PRESENCE_PING_INTERVAL_SECS = 50+# Specifies the number of active users in the realm# above which sending of presence update events will be disabled.USER_LIMIT_FOR_SENDING_PRESENCE_UPDATE_EVENTS = 100