Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
actions: Update default streams state when user role is changed.
Vishnu KS4e0dac9e6c30
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex c3d296d5d36..5fdec1dd9a5 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -679,6 +679,13 @@ def apply_event(user_profile, include_all_active=user_profile.is_realm_admin)+ if state["is_guest"]:+ state["realm_default_streams"] = []+ else:+ state["realm_default_streams"] = streams_to_dicts_sorted(+ get_default_streams_for_realm(user_profile.realm_id)+ )+for field in ["delivery_email", "email", "full_name", "is_billing_admin"]:if field in person and field in state:state[field] = person[field]diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex 810207fcc4d..006e745d09a 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -1337,6 +1337,9 @@ class NormalActionsTest(BaseAction):self.assertEqual(events[0]["person"]["role"], role)def test_change_is_guest(self) -> None:+ stream = Stream.objects.get(name="Denmark")+ do_add_default_stream(stream)+reset_emails_in_zulip_realm()# Important: We need to refresh from the database here so that