presence: Return some presence params in the /register response.

This commit is contained in:
Mateusz Mandera 2023-02-20 22:39:40 +01:00 committed by Tim Abbott
parent 4ba4305ff9
commit a593089770
6 changed files with 41 additions and 1 deletions

View File

@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 7.0 ## 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** **Feature level 163**
* [`GET /users`](/api/get-users), [`GET /users/{user_id}`](/api/get-user), * [`GET /users`](/api/get-users), [`GET /users/{user_id}`](/api/get-user),

View File

@ -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 api_docs/changelog.md, as well as "**Changes**" # new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`. # 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 # 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

View File

@ -354,6 +354,10 @@ def fetch_initial_state_data(
realm.demo_organization_scheduled_deletion_date 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"): if want("realm_user_settings_defaults"):
realm_user_default = RealmUserDefault.objects.get(realm=realm) realm_user_default = RealmUserDefault.objects.get(realm=realm)
state["realm_user_settings_defaults"] = {} state["realm_user_settings_defaults"] = {}

View File

@ -10260,6 +10260,31 @@ paths:
**Changes**: New in Zulip 4.0 (feature level 53). Previously, **Changes**: New in Zulip 4.0 (feature level 53). Previously,
this property always had a value of 10000. 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: muted_topics:
type: array type: array
deprecated: true deprecated: true

View File

@ -196,6 +196,8 @@ class HomeTest(ZulipTestCase):
"server_inline_url_embed_preview", "server_inline_url_embed_preview",
"server_name_changes_disabled", "server_name_changes_disabled",
"server_needs_upgrade", "server_needs_upgrade",
"server_presence_offline_threshold_seconds",
"server_presence_ping_interval_seconds",
"server_timestamp", "server_timestamp",
"server_web_public_streams_enabled", "server_web_public_streams_enabled",
"settings_send_digest_emails", "settings_send_digest_emails",

View File

@ -491,6 +491,9 @@ STAGING = False
# Should match the presence.js constant. # Should match the presence.js constant.
OFFLINE_THRESHOLD_SECS = 140 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 # Specifies the number of active users in the realm
# above which sending of presence update events will be disabled. # above which sending of presence update events will be disabled.
USER_LIMIT_FOR_SENDING_PRESENCE_UPDATE_EVENTS = 100 USER_LIMIT_FOR_SENDING_PRESENCE_UPDATE_EVENTS = 100