Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
api: Deprecate user_settings_object client capability.
Tim Abbottb51ef6ea3f64
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 6d94d07519c..f5b3e8a163b 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -166,7 +166,6 @@ def fetch_initial_state_data(queue_id: str | None = "",client_gravatar: bool = False,user_avatar_url_field_optional: bool = False,- user_settings_object: bool = False,slim_presence: bool = False,presence_last_update_id_fetched_by_client: int | None = None,presence_history_limit_days: int | None = None,@@ -1993,13 +1992,14 @@ class ClientCapabilities(TypedDict):bulk_message_deletion: NotRequired[bool]user_avatar_url_field_optional: NotRequired[bool]stream_typing_notifications: NotRequired[bool]- user_settings_object: NotRequired[bool]linkifier_url_template: NotRequired[bool]user_list_incomplete: NotRequired[bool]include_deactivated_groups: NotRequired[bool]archived_channels: NotRequired[bool]empty_topic_name: NotRequired[bool]simplified_presence_events: NotRequired[bool]+ # Deprecated and no longer has any effect+ user_settings_object: NotRequired[bool]DEFAULT_CLIENT_CAPABILITIES = ClientCapabilities(notification_settings_null=False)@@ -2036,7 +2036,6 @@ def do_events_register("user_avatar_url_field_optional", False)stream_typing_notifications = client_capabilities.get("stream_typing_notifications", False)- user_settings_object = client_capabilities.get("user_settings_object", False)linkifier_url_template = client_capabilities.get("linkifier_url_template", False)user_list_incomplete = client_capabilities.get("user_list_incomplete", False)include_deactivated_groups = client_capabilities.get("include_deactivated_groups", False)@@ -2065,7 +2064,6 @@ def do_events_register(client_gravatar=client_gravatar,linkifier_url_template=linkifier_url_template,user_avatar_url_field_optional=user_avatar_url_field_optional,- user_settings_object=user_settings_object,user_list_incomplete=user_list_incomplete,archived_channels=archived_channels,# These presence params are a noop, because presence is not included.@@ -2108,7 +2106,6 @@ def do_events_register(narrow=legacy_narrow,bulk_message_deletion=bulk_message_deletion,stream_typing_notifications=stream_typing_notifications,- user_settings_object=user_settings_object,pronouns_field_type_supported=pronouns_field_type_supported,linkifier_url_template=linkifier_url_template,user_list_incomplete=user_list_incomplete,@@ -2128,7 +2125,6 @@ def do_events_register(queue_id=queue_id,client_gravatar=client_gravatar,user_avatar_url_field_optional=user_avatar_url_field_optional,- user_settings_object=user_settings_object,slim_presence=slim_presence,presence_last_update_id_fetched_by_client=presence_last_update_id_fetched_by_client,presence_history_limit_days=presence_history_limit_days,diff --git a/zerver/lib/home.py b/zerver/lib/home.pyindex 309aaeaf70e..82ef7311c3f 100644--- a/zerver/lib/home.py+++ b/zerver/lib/home.py@@ -96,7 +96,6 @@ def build_page_params_for_home_page_load(bulk_message_deletion=True,user_avatar_url_field_optional=True,stream_typing_notifications=True,- user_settings_object=True,linkifier_url_template=True,user_list_incomplete=True,include_deactivated_groups=True,diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 56a8a9df615..755a88a7024 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -16428,20 +16428,20 @@ paths:for backwards-compatibility; it will be required in afuture server release.- - `user_settings_object`: Boolean for whether the client supports the modern- `user_settings` event type. If false, the server will additionally send the- legacy `update_global_notifications` and `update_display_settings` event- types.+ - `user_settings_object`: Has no effect with modern servers. Previously, this+ was a boolean for whether the client supported the modern `user_settings` event type.<br />- **Changes**: New in Zulip 5.0 (feature level 89). This capability is for- backwards-compatibility; it will be removed in a future server release.- Because the feature level 89 API changes were merged together, clients can- safely make a request with this client capability and also request all three- event types (`user_settings`, `update_display_settings`,- `update_global_notifications`), and get exactly one copy of settings data on- any server version. Clients can then use the `zulip_feature_level` in the- `/register` response or the presence/absence of a `user_settings` key to- determine where to look for the data.+ **Changes**: Prior to Zulip 12.0 (feature level 439), if false, the server+ would additionally send the legacy `update_global_notifications` and+ `update_display_settings` event types if requested.++ New in Zulip 5.0 (feature level 89). Because the feature level 89 API changes+ were merged together, clients can safely make a request with this client+ capability and also request all three event types (`user_settings`,+ `update_display_settings`, `update_global_notifications`), and get exactly one+ copy of settings data on any server version. Clients can then use the+ `zulip_feature_level` in the `/register` response or the presence/absence of a+ `user_settings` key to determine where to look for the data.- `linkifier_url_template`: Boolean for whether the client accepts[linkifiers][help-linkifiers] that use [RFC 6570][rfc6570] compliantdiff --git a/zerver/tests/test_event_system.py b/zerver/tests/test_event_system.pyindex 8293b00c46e..9ef7f6a73cf 100644--- a/zerver/tests/test_event_system.py+++ b/zerver/tests/test_event_system.py@@ -782,27 +782,6 @@ class FetchInitialStateDataTest(ZulipTestCase):else:self.assertFalse("avatar_url" in user_dict)- def test_user_settings_based_on_client_capabilities(self) -> None:- hamlet = self.example_user("hamlet")- result = fetch_initial_state_data(- user_profile=hamlet,- realm=hamlet.realm,- user_settings_object=True,- )- self.assertIn("user_settings", result)- for prop in UserProfile.property_types:- self.assertNotIn(prop, result)- self.assertIn(prop, result["user_settings"])-- result = fetch_initial_state_data(- user_profile=hamlet,- realm=hamlet.realm,- user_settings_object=False,- )- self.assertIn("user_settings", result)- for prop in UserProfile.property_types:- self.assertIn(prop, result["user_settings"])-def test_realm_linkifiers_based_on_client_capabilities(self) -> None:user = self.example_user("iago")self.login_user(user)diff --git a/zerver/tornado/django_api.py b/zerver/tornado/django_api.pyindex a85014992e6..e904deb2cef 100644--- a/zerver/tornado/django_api.py+++ b/zerver/tornado/django_api.py@@ -87,7 +87,6 @@ def request_event_queue(narrow: Iterable[Sequence[str]] = [],bulk_message_deletion: bool = False,stream_typing_notifications: bool = False,- user_settings_object: bool = False,pronouns_field_type_supported: bool = True,linkifier_url_template: bool = False,user_list_incomplete: bool = False,@@ -119,7 +118,6 @@ def request_event_queue("lifespan_secs": queue_lifespan_secs,"bulk_message_deletion": orjson.dumps(bulk_message_deletion),"stream_typing_notifications": orjson.dumps(stream_typing_notifications),- "user_settings_object": orjson.dumps(user_settings_object),"pronouns_field_type_supported": orjson.dumps(pronouns_field_type_supported),"linkifier_url_template": orjson.dumps(linkifier_url_template),"user_list_incomplete": orjson.dumps(user_list_incomplete),diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.pyindex 617844adb75..946ecd2da4e 100644--- a/zerver/tornado/event_queue.py+++ b/zerver/tornado/event_queue.py@@ -77,7 +77,6 @@ class ClientDescriptor:narrow: Collection[Sequence[str]],bulk_message_deletion: bool,stream_typing_notifications: bool,- user_settings_object: bool,pronouns_field_type_supported: bool,linkifier_url_template: bool,user_list_incomplete: bool,@@ -112,7 +111,6 @@ class ClientDescriptor:self.narrow_predicate = build_narrow_predicate(modern_narrow)self.bulk_message_deletion = bulk_message_deletionself.stream_typing_notifications = stream_typing_notifications- self.user_settings_object = user_settings_objectself.pronouns_field_type_supported = pronouns_field_type_supportedself.linkifier_url_template = linkifier_url_templateself.user_list_incomplete = user_list_incomplete@@ -146,7 +144,6 @@ class ClientDescriptor:client_type_name=self.client_type_name,bulk_message_deletion=self.bulk_message_deletion,stream_typing_notifications=self.stream_typing_notifications,- user_settings_object=self.user_settings_object,pronouns_field_type_supported=self.pronouns_field_type_supported,linkifier_url_template=self.linkifier_url_template,user_list_incomplete=self.user_list_incomplete,@@ -187,7 +184,6 @@ class ClientDescriptor:narrow=d.get("narrow", []),bulk_message_deletion=d.get("bulk_message_deletion", False),stream_typing_notifications=d.get("stream_typing_notifications", False),- user_settings_object=d.get("user_settings_object", False),pronouns_field_type_supported=d.get("pronouns_field_type_supported", True),linkifier_url_template=d.get("linkifier_url_template", False),user_list_incomplete=d.get("user_list_incomplete", False),diff --git a/zerver/tornado/views.py b/zerver/tornado/views.pyindex f735ee01b0b..0601308195d 100644--- a/zerver/tornado/views.py+++ b/zerver/tornado/views.py@@ -190,10 +190,6 @@ def get_events_backend(Json[bool],ApiParamConfig(documentation_status=DocumentationStatus.INTENTIONALLY_UNDOCUMENTED),] = False,- user_settings_object: Annotated[- Json[bool],- ApiParamConfig(documentation_status=DocumentationStatus.INTENTIONALLY_UNDOCUMENTED),- ] = False,pronouns_field_type_supported: Annotated[Json[bool],ApiParamConfig(documentation_status=DocumentationStatus.INTENTIONALLY_UNDOCUMENTED),@@ -256,7 +252,6 @@ def get_events_backend(narrow=narrow,bulk_message_deletion=bulk_message_deletion,stream_typing_notifications=stream_typing_notifications,- user_settings_object=user_settings_object,pronouns_field_type_supported=pronouns_field_type_supported,linkifier_url_template=linkifier_url_template,user_list_incomplete=user_list_incomplete,