Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
apply_event: Do not include new user settings in the top level.
Dinesh0b68f264c6d1
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 745c78863d9..70fc0f0407d 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -1197,7 +1197,11 @@ def apply_event(# this setting is not a part of UserBaseSettings class.if event["property"] != "timezone":assert event["property"] in UserProfile.property_types- state[event["property"]] = event["value"]+ 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":passdiff --git a/zerver/tests/test_event_system.py b/zerver/tests/test_event_system.pyindex a8ac735e458..871aaa50dc8 100644--- a/zerver/tests/test_event_system.py+++ b/zerver/tests/test_event_system.py@@ -564,7 +564,12 @@ class FetchInitialStateDataTest(ZulipTestCase):)self.assertIn("user_settings", result)for prop in UserProfile.property_types:- self.assertIn(prop, result)+ 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"])