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.

user_settings: Remove legacy notification and display settings.

Aditya Kumar Kasaudhan45a86dd73ad9
diff --git a/api_docs/unmerged.d/ZF-651304.md b/api_docs/unmerged.d/ZF-651304.md
new file mode 100644
index 00000000000..6767ba6f9c2
--- /dev/null
+++ b/api_docs/unmerged.d/ZF-651304.md
@@ -0,0 +1,4 @@
+* [`GET /events`](/api/get-events): The deprecated `update_display_settings`
+ and `update_global_notifications` event types are no longer sent to any
+ clients. These legacy event types were deprecated in Zulip 5.0 (feature
+ level 89) and replaced by the `user_settings` event type.
diff --git a/zerver/actions/user_settings.py b/zerver/actions/user_settings.py
index 212c642097f..5fb972d45af 100644
--- a/zerver/actions/user_settings.py
+++ b/zerver/actions/user_settings.py
@@ -507,34 +507,6 @@ def do_change_user_setting(
send_event_on_commit(user_profile.realm, event, [user_profile.id])
- if setting_name in UserProfile.notification_settings_legacy:
- # This legacy event format is for backwards-compatibility with
- # clients that don't support the new user_settings event type.
- # We only send this for settings added before Feature level 89.
- legacy_event = {
- "type": "update_global_notifications",
- "user": user_profile.email,
- "notification_name": setting_name,
- "setting": event_value,
- }
- send_event_on_commit(user_profile.realm, legacy_event, [user_profile.id])
-
- if setting_name in UserProfile.display_settings_legacy or setting_name == "timezone":
- # This legacy event format is for backwards-compatibility with
- # clients that don't support the new user_settings event type.
- # We only send this for settings added before Feature level 89.
- legacy_event = {
- "type": "update_display_settings",
- "user": user_profile.email,
- "setting_name": setting_name,
- "setting": event_value,
- }
- if setting_name == "default_language":
- assert isinstance(db_setting_value, str)
- legacy_event["language_name"] = get_language_name(db_setting_value)
-
- send_event_on_commit(user_profile.realm, legacy_event, [user_profile.id])
-
if setting_name == "allow_private_data_export":
realm_export_event = {
"type": "realm_export_consent",
diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py
index 097247050e4..8016fa97f7c 100644
--- a/zerver/lib/event_schema.py
+++ b/zerver/lib/event_schema.py
@@ -89,8 +89,6 @@ from zerver.lib.event_types import (
EventTypingEditMessageStop,
EventTypingStart,
EventTypingStop,
- EventUpdateDisplaySettings,
- EventUpdateGlobalNotifications,
EventUpdateMessage,
EventUpdateMessageFlagsAdd,
EventUpdateMessageFlagsRemove,
@@ -261,8 +259,6 @@ _check_realm_update_dict = make_checker(EventRealmUpdateDict)
_check_realm_user_update = make_checker(EventRealmUserUpdate)
_check_stream_update = make_checker(EventStreamUpdate)
_check_subscription_update = make_checker(EventSubscriptionUpdate)
-_check_update_display_settings = make_checker(EventUpdateDisplaySettings)
-_check_update_global_notifications = make_checker(EventUpdateGlobalNotifications)
_check_update_message = make_checker(EventUpdateMessage)
_check_user_group_update = make_checker(EventUserGroupUpdate)
_check_user_settings_update = make_checker(EventUserSettingsUpdate)
@@ -630,32 +626,6 @@ def check_subscription_update(
assert event["value"] == value
-def check_update_display_settings(
- var_name: str,
- event: dict[str, object],
-) -> None:
- """
- Display setting events have a "setting" field that
- is more specifically typed according to the
- UserProfile.property_types dictionary.
- """
- _check_update_display_settings(var_name, event)
- setting_name = event["setting_name"]
- setting = event["setting"]
-
- assert isinstance(setting_name, str)
- if setting_name == "timezone":
- assert isinstance(setting, str)
- else:
- setting_type = UserProfile.property_types[setting_name]
- assert isinstance(setting, setting_type)
-
- if setting_name == "default_language":
- assert "language_name" in event
- else:
- assert "language_name" not in event
-
-
def check_user_settings_update(
var_name: str,
event: dict[str, object],
@@ -681,25 +651,6 @@ def check_user_settings_update(
assert "language_name" not in event
-def check_update_global_notifications(
- var_name: str,
- event: dict[str, object],
- desired_val: bool | int | str,
-) -> None:
- """
- See UserProfile.notification_settings_legacy for
- more details.
- """
- _check_update_global_notifications(var_name, event)
- setting_name = event["notification_name"]
- setting = event["setting"]
- assert setting == desired_val
-
- assert isinstance(setting_name, str)
- setting_type = UserProfile.notification_settings_legacy[setting_name]
- assert isinstance(setting, setting_type)
-
-
def check_update_message(
var_name: str,
event: dict[str, object],
diff --git a/zerver/lib/event_types.py b/zerver/lib/event_types.py
index e79a0573db1..2092a909663 100644
--- a/zerver/lib/event_types.py
+++ b/zerver/lib/event_types.py
@@ -1066,25 +1066,6 @@ class EventTypingEditMessageStop(BaseEvent):
recipient: RecipientFieldForTypingEditChannelMessage | RecipientFieldForTypingEditDirectMessage
-class EventUpdateDisplaySettingsCore(BaseEvent):
- type: Literal["update_display_settings"]
- setting_name: str
- setting: bool | int | str
- user: str
-
-
-class EventUpdateDisplaySettings(EventUpdateDisplaySettingsCore):
- # TODO: fix types to avoid optional fields
- language_name: str | None = None
-
-
-class EventUpdateGlobalNotifications(BaseEvent):
- type: Literal["update_global_notifications"]
- notification_name: str
- setting: bool | int | str
- user: str
-
-
class EventUpdateMessageCore(BaseEvent):
type: Literal["update_message"]
user_id: int | None
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index bbb82a047ed..6d94d07519c 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -876,17 +876,6 @@ def fetch_initial_state_data(
if want("stop_words"):
state["stop_words"] = read_stop_words()
- if want("update_display_settings") and not user_settings_object:
- for prop in UserProfile.display_settings_legacy:
- state[prop] = getattr(settings_user, prop)
- state["emojiset_choices"] = UserProfile.emojiset_choices()
- state["timezone"] = canonicalize_timezone(settings_user.timezone)
-
- if want("update_global_notifications") and not user_settings_object:
- for notification in UserProfile.notification_settings_legacy:
- state[notification] = getattr(settings_user, notification)
- state["available_notification_sounds"] = get_available_notification_sounds()
-
if want("user_settings"):
state["user_settings"] = {}
@@ -1855,23 +1844,12 @@ def apply_event(
state["realm_linkifiers"] = event["realm_linkifiers"]
elif event["type"] == "realm_playgrounds":
state["realm_playgrounds"] = event["realm_playgrounds"]
- elif event["type"] == "update_display_settings":
- if event["setting_name"] != "timezone":
- assert event["setting_name"] in UserProfile.display_settings_legacy
- state[event["setting_name"]] = event["setting"]
- elif event["type"] == "update_global_notifications":
- assert event["notification_name"] in UserProfile.notification_settings_legacy
- state[event["notification_name"]] = event["setting"]
+
elif event["type"] == "user_settings":
# time zone setting is not included in property_types dict because
# this setting is not a part of UserBaseSettings class.
if event["property"] != "timezone":
assert event["property"] in UserProfile.property_types
- if event["property"] in {
- **UserProfile.display_settings_legacy,
- **UserProfile.notification_settings_legacy,
- }:
- state[event["property"]] = event["value"]
state["user_settings"][event["property"]] = event["value"]
elif event["type"] == "invites_changed":
pass
diff --git a/zerver/models/users.py b/zerver/models/users.py
index abbe2f31f6b..5c8bfcd1489 100644
--- a/zerver/models/users.py
+++ b/zerver/models/users.py
@@ -325,31 +325,19 @@ class UserBaseSettings(models.Model):
# Whether user wants to see AI features in the UI.
hide_ai_features = models.BooleanField(default=False)
- display_settings_legacy = dict(
- # Don't add anything new to this legacy dict.
- # Instead, see `modern_settings` below.
- color_scheme=int,
- default_language=str,
- web_home_view=str,
- demote_inactive_streams=int,
- emojiset=str,
- enable_drafts_synchronization=bool,
- enter_sends=bool,
- fluid_layout_width=bool,
- high_contrast_mode=bool,
- left_side_userlist=bool,
- starred_message_counts=bool,
- translate_emoticons=bool,
- twenty_four_hour_time=bool,
- )
-
- notification_settings_legacy = dict(
- # Don't add anything new to this legacy dict.
- # Instead, see `modern_notification_settings` below.
+ modern_notification_settings = dict(
+ automatically_follow_topics_policy=int,
+ automatically_follow_topics_where_mentioned=bool,
+ automatically_unmute_topics_in_muted_streams_policy=int,
desktop_icon_count_display=int,
email_notifications_batching_period_seconds=int,
enable_desktop_notifications=bool,
enable_digest_emails=bool,
+ enable_followed_topic_audible_notifications=bool,
+ enable_followed_topic_desktop_notifications=bool,
+ enable_followed_topic_email_notifications=bool,
+ enable_followed_topic_push_notifications=bool,
+ enable_followed_topic_wildcard_mentions_notify=bool,
enable_login_emails=bool,
enable_marketing_emails=bool,
enable_offline_email_notifications=bool,
@@ -369,21 +357,33 @@ class UserBaseSettings(models.Model):
)
modern_settings = dict(
- # Add new general settings here.
allow_private_data_export=bool,
+ color_scheme=int,
+ default_language=str,
+ demote_inactive_streams=int,
display_emoji_reaction_users=bool,
email_address_visibility=int,
+ emojiset=str,
+ enable_drafts_synchronization=bool,
+ enter_sends=bool,
+ fluid_layout_width=bool,
hide_ai_features=bool,
+ high_contrast_mode=bool,
+ left_side_userlist=bool,
receives_typing_notifications=bool,
resolved_topic_notice_auto_read_policy=ResolvedTopicNoticeAutoReadPolicyEnum,
send_private_typing_notifications=bool,
send_read_receipts=bool,
send_stream_typing_notifications=bool,
+ starred_message_counts=bool,
+ translate_emoticons=bool,
+ twenty_four_hour_time=bool,
user_list_style=int,
web_animate_image_previews=str,
web_channel_default_view=int,
web_escape_navigates_to_home_view=bool,
web_font_size_px=int,
+ web_home_view=str,
web_inbox_show_channel_folders=bool,
web_left_sidebar_show_channel_folders=bool,
web_left_sidebar_unreads_count_summary=bool,
@@ -394,26 +394,10 @@ class UserBaseSettings(models.Model):
web_suggest_update_timezone=bool,
)
- modern_notification_settings = dict(
- # Add new notification settings here.
- automatically_follow_topics_policy=int,
- automatically_follow_topics_where_mentioned=bool,
- automatically_unmute_topics_in_muted_streams_policy=int,
- enable_followed_topic_audible_notifications=bool,
- enable_followed_topic_desktop_notifications=bool,
- enable_followed_topic_email_notifications=bool,
- enable_followed_topic_push_notifications=bool,
- enable_followed_topic_wildcard_mentions_notify=bool,
- )
-
- notification_setting_types = {
- **notification_settings_legacy,
- **modern_notification_settings,
- }
+ notification_setting_types = modern_notification_settings
# Define the types of the various automatically managed properties
property_types = {
- **display_settings_legacy,
**notification_setting_types,
**modern_settings,
}
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index e1aa05a81cc..aa6af49fc29 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -248,105 +248,17 @@ paths:
"alert_words": ["alert_word"],
"id": 0,
}
- - type: object
- description: |
- Event sent to clients that have requested the
- `update_display_settings` event type and did not include
- `user_settings_object` in their `client_capabilities` when
- registering the event queue.
-
- **Changes**: Deprecated in Zulip 5.0 (feature level 89). Clients
- connecting to newer servers should declare the `user_settings_object`
- client capability and process the `user_settings` event type instead.
- deprecated: true
- properties:
- id:
- $ref: "#/components/schemas/EventIdSchema"
- type:
- allOf:
- - $ref: "#/components/schemas/EventTypeSchema"
- - enum:
- - update_display_settings
- user:
- type: string
- description: |
- The Zulip API email of the user.
- setting_name:
- type: string
- description: |
- Name of the changed display setting.
- setting:
- description: |
- New value of the changed setting.
- oneOf:
- - type: boolean
- - type: integer
- - type: string
- language_name:
- description: |
- Present only if the setting to be changed is
- `default_language`. Contains the name of the
- new default language in English.
- type: string
- additionalProperties: false
- example:
- {
- "type": "update_display_settings",
- "user": "[email protected]",
- "setting_name": "high_contrast_mode",
- "setting": false,
- "id": 0,
- }
- - type: object
- description: |
- Event sent to a user's clients when that user's [notification
- settings](/api/update-settings) have changed with an additional
- rule that it is only sent to clients that did not include
- `user_settings_object` in their `client_capabilities` when
- registering the event queue.
-
- **Changes**: Deprecated in Zulip 5.0 (feature level 89). Clients
- connecting to newer servers should declare the `user_settings_object`
- client capability and process the `user_settings` event type instead.
- deprecated: true
- properties:
- id:
- $ref: "#/components/schemas/EventIdSchema"
- type:
- allOf:
- - $ref: "#/components/schemas/EventTypeSchema"
- - enum:
- - update_global_notifications
- user:
- type: string
- description: |
- The Zulip API email of the user.
- notification_name:
- type: string
- description: |
- Name of the changed notification setting.
- setting:
- description: |
- New value of the changed setting.
- oneOf:
- - type: boolean
- - type: integer
- - type: string
- additionalProperties: false
- example:
- {
- "type": "update_global_notifications",
- "user": "[email protected]",
- "notification_name": "enable_sounds",
- "setting": true,
- "id": 0,
- }
- type: object
description: |
Event sent to a user's clients when that user's settings
have changed.
- **Changes**: New in Zulip 5.0 (feature level 89), replacing the
+ **Changes**: The `update_display_settings` and `update_global_notifications`
+ legacy event types that had been deprecated in Zulip 5.0 (feature level 89)
+ were removed entirely in Zulip 12.0 (feature level ZF-651304). All clients should
+ be using the `user_settings` event type to access user settings.
+
+ New in Zulip 5.0 (feature level 89), replacing the
previous `update_display_settings` and `update_global_notifications`
event types, which are still present for backwards compatibility reasons.
properties:
diff --git a/zerver/tests/test_event_system.py b/zerver/tests/test_event_system.py
index 25c95ef546f..8293b00c46e 100644
--- a/zerver/tests/test_event_system.py
+++ b/zerver/tests/test_event_system.py
@@ -801,12 +801,6 @@ class FetchInitialStateDataTest(ZulipTestCase):
)
self.assertIn("user_settings", result)
for prop in UserProfile.property_types:
- if prop in {
- **UserProfile.display_settings_legacy,
- **UserProfile.notification_settings_legacy,
- }:
- # Only legacy settings are included in the top level.
- self.assertIn(prop, result)
self.assertIn(prop, result["user_settings"])
def test_realm_linkifiers_based_on_client_capabilities(self) -> None:
@@ -1290,8 +1284,6 @@ class FetchQueriesTest(ZulipTestCase):
# 3 of the 9 queries here are shared with other event types
# as mentioned above.
subscription=9,
- update_display_settings=0,
- update_global_notifications=0,
update_message_flags=7,
user_settings=0,
user_status=1,
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 09bb49bbc50..78e88580d78 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -234,8 +234,6 @@ from zerver.lib.event_schema import (
check_typing_edit_message_stop,
check_typing_start,
check_typing_stop,
- check_update_display_settings,
- check_update_global_notifications,
check_update_message,
check_update_message_flags_add,
check_update_message_flags_remove,
@@ -2060,7 +2058,7 @@ class NormalActionsTest(BaseAction):
# Set all
away_val = True
- with self.verify_action(num_events=4) as events:
+ with self.verify_action(num_events=3) as events:
do_update_user_status(
user_profile=self.user_profile,
away=away_val,
@@ -2072,15 +2070,14 @@ class NormalActionsTest(BaseAction):
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], not away_val)
check_user_status(
- "events[2]",
- events[2],
+ "events[1]",
+ events[1],
{"away", "status_text", "emoji_name", "emoji_code", "reaction_type"},
)
check_legacy_presence(
- "events[3]",
- events[3],
+ "events[2]",
+ events[2],
has_email=True,
presence_key="website",
status="active",
@@ -2088,7 +2085,7 @@ class NormalActionsTest(BaseAction):
# Remove all
away_val = False
- with self.verify_action(num_events=4) as events:
+ with self.verify_action(num_events=3) as events:
do_update_user_status(
user_profile=self.user_profile,
away=away_val,
@@ -2100,15 +2097,14 @@ class NormalActionsTest(BaseAction):
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], not away_val)
check_user_status(
- "events[2]",
- events[2],
+ "events[1]",
+ events[1],
{"away", "status_text", "emoji_name", "emoji_code", "reaction_type"},
)
check_legacy_presence(
- "events[3]",
- events[3],
+ "events[2]",
+ events[2],
has_email=True,
presence_key="website",
status="active",
@@ -2116,7 +2112,7 @@ class NormalActionsTest(BaseAction):
# Only set away
away_val = True
- with self.verify_action(num_events=4) as events:
+ with self.verify_action(num_events=3) as events:
do_update_user_status(
user_profile=self.user_profile,
away=away_val,
@@ -2128,11 +2124,10 @@ class NormalActionsTest(BaseAction):
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], not away_val)
- check_user_status("events[2]", events[2], {"away"})
+ check_user_status("events[1]", events[1], {"away"})
check_legacy_presence(
- "events[3]",
- events[3],
+ "events[2]",
+ events[2],
has_email=True,
presence_key="website",
status="active",
@@ -3166,16 +3161,8 @@ class NormalActionsTest(BaseAction):
self.user_profile, notification_setting, False, acting_user=self.user_profile
)
- num_events = 2
- is_modern_notification_setting = (
- notification_setting in self.user_profile.modern_notification_settings
- )
- if is_modern_notification_setting:
- # The legacy event format is not sent for modern_notification_settings
- # as it exists only for backwards-compatibility with
- # clients that don't support the new user_settings event type.
- # We only send the legacy event for settings added before Feature level 89.
- num_events = 1
+ # Since legacy events have been removed, only user_settings events are sent
+ num_events = 1
for setting_value in [True, False]:
with self.verify_action(num_events=num_events) as events:
@@ -3186,8 +3173,6 @@ class NormalActionsTest(BaseAction):
acting_user=self.user_profile,
)
check_user_settings_update("events[0]", events[0])
- if not is_modern_notification_setting:
- check_update_global_notifications("events[1]", events[1], setting_value)
# Also test with notification_settings_null=True
with self.verify_action(
@@ -3202,8 +3187,6 @@ class NormalActionsTest(BaseAction):
acting_user=self.user_profile,
)
check_user_settings_update("events[0]", events[0])
- if not is_modern_notification_setting:
- check_update_global_notifications("events[1]", events[1], setting_value)
def test_change_presence_enabled(self) -> None:
presence_enabled_setting = "presence_enabled"
@@ -3213,7 +3196,7 @@ class NormalActionsTest(BaseAction):
# with a last_connected_time and last_active_time slightly preceding the moment of flipping the
# setting.
for val in [True, False]:
- with self.verify_action(num_events=3) as events:
+ with self.verify_action(num_events=2) as events:
do_change_user_setting(
self.user_profile,
presence_enabled_setting,
@@ -3221,54 +3204,48 @@ class NormalActionsTest(BaseAction):
acting_user=self.user_profile,
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], val)
check_legacy_presence(
- "events[2]", events[2], has_email=True, presence_key="website", status="active"
+ "events[1]", events[1], has_email=True, presence_key="website", status="active"
)
def test_change_notification_sound(self) -> None:
notification_setting = "notification_sound"
- with self.verify_action(num_events=2) as events:
+ with self.verify_action(num_events=1) as events:
do_change_user_setting(
self.user_profile, notification_setting, "ding", acting_user=self.user_profile
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], "ding")
def test_change_desktop_icon_count_display(self) -> None:
notification_setting = "desktop_icon_count_display"
- with self.verify_action(num_events=2) as events:
+ with self.verify_action(num_events=1) as events:
do_change_user_setting(
self.user_profile, notification_setting, 2, acting_user=self.user_profile
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], 2)
- with self.verify_action(num_events=2) as events:
+ with self.verify_action(num_events=1) as events:
do_change_user_setting(
self.user_profile, notification_setting, 1, acting_user=self.user_profile
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], 1)
def test_change_realm_name_in_email_notifications_policy(self) -> None:
notification_setting = "realm_name_in_email_notifications_policy"
- with self.verify_action(num_events=2) as events:
+ with self.verify_action(num_events=1) as events:
do_change_user_setting(
self.user_profile, notification_setting, 3, acting_user=self.user_profile
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], 3)
- with self.verify_action(num_events=2) as events:
+ with self.verify_action(num_events=1) as events:
do_change_user_setting(
self.user_profile, notification_setting, 2, acting_user=self.user_profile
)
check_user_settings_update("events[0]", events[0])
- check_update_global_notifications("events[1]", events[1], 2)
def test_change_automatically_follow_topics_policy(self) -> None:
notification_setting = "automatically_follow_topics_policy"
@@ -4886,15 +4863,8 @@ class UserDisplayActionTest(BaseAction):
user_settings_object = True
num_events = 1
- legacy_setting = setting_name in UserProfile.display_settings_legacy
- if legacy_setting:
- # Two events:`update_display_settings` and `user_settings`.
- # `update_display_settings` is only sent for settings added
- # before feature level 89 which introduced `user_settings`.
- # We send both events so that older clients that do not
- # rely on `user_settings` don't break.
- num_events = 2
- user_settings_object = False
+ # Legacy display settings events have been removed, so all settings
+ # now only send user_settings events
values = test_changes.get(setting_name)
@@ -4933,11 +4903,6 @@ class UserDisplayActionTest(BaseAction):
)
check_user_settings_update("events[0]", events[0])
- if legacy_setting:
- # Only settings added before feature level 89
- # generate this event.
- self.assert_length(events, 2)
- check_update_display_settings("events[1]", events[1])
def test_change_user_settings(self) -> None:
for prop in UserProfile.property_types:
@@ -4981,7 +4946,7 @@ class UserDisplayActionTest(BaseAction):
def test_set_user_timezone(self) -> None:
values = ["America/Denver", "Pacific/Pago_Pago", "Pacific/Galapagos", ""]
- num_events = 3
+ num_events = 2
for value in values:
with self.verify_action(num_events=num_events) as events:
@@ -4993,8 +4958,7 @@ class UserDisplayActionTest(BaseAction):
)
check_user_settings_update("events[0]", events[0])
- check_update_display_settings("events[1]", events[1])
- check_realm_user_update("events[2]", events[2], "timezone")
+ check_realm_user_update("events[1]", events[1], "timezone")
def test_delivery_email_events_on_changing_email_address_visibility(self) -> None:
cordelia = self.example_user("cordelia")
diff --git a/zerver/tests/test_user_status.py b/zerver/tests/test_user_status.py
index 08944b054bd..160edff6853 100644
--- a/zerver/tests/test_user_status.py
+++ b/zerver/tests/test_user_status.py
@@ -194,7 +194,7 @@ class UserStatusTest(ZulipTestCase):
if num_events == 1:
self.assertEqual(events[0]["event"], expected_event)
else:
- self.assertEqual(events[2]["event"], expected_event)
+ self.assertEqual(events[1]["event"], expected_event)
def test_endpoints(self) -> None:
hamlet = self.example_user("hamlet")
@@ -260,7 +260,7 @@ class UserStatusTest(ZulipTestCase):
expected_event=dict(
type="user_status", user_id=hamlet.id, away=True, status_text="on vacation"
),
- num_events=4,
+ num_events=3,
)
self.assertEqual(
user_status_info(hamlet),
@@ -345,7 +345,7 @@ class UserStatusTest(ZulipTestCase):
self.update_status_and_assert_event(
payload=dict(away=orjson.dumps(False).decode()),
expected_event=dict(type="user_status", user_id=hamlet.id, away=False),
- num_events=4,
+ num_events=3,
)
self.assertEqual(
user_status_info(hamlet),
@@ -397,7 +397,7 @@ class UserStatusTest(ZulipTestCase):
self.update_status_and_assert_event(
payload=dict(away=orjson.dumps(True).decode()),
expected_event=dict(type="user_status", user_id=hamlet.id, away=True),
- num_events=4,
+ num_events=3,
)
# Setting away is a deprecated way of accessing a user's presence_enabled
@@ -532,7 +532,7 @@ class UserStatusTest(ZulipTestCase):
expected_event=dict(
type="user_status", user_id=hamlet.id, away=True, status_text="on vacation"
),
- num_events=3,
+ num_events=2,
)
self.assertEqual(
user_status_info(hamlet),
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index 1390bd1aadd..617844adb75 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -244,14 +244,6 @@ class ClientDescriptor:
# delivered if the stream_typing_notifications
# client_capability is enabled, for backwards compatibility.
return self.stream_typing_notifications
- if self.user_settings_object and event["type"] in [
- "update_display_settings",
- "update_global_notifications",
- ]:
- # 'update_display_settings' and 'update_global_notifications'
- # events are sent only if user_settings_object is False,
- # otherwise only 'user_settings' event is sent.
- return False
if event["type"] == "user_group":
if event["op"] == "remove":
# 'user_group/remove' events are only sent if the client