Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
streams: Set `include_all` to True.
Shubham Padia0c7c13fc3004
diff --git a/zerver/actions/users.py b/zerver/actions/users.pyindex 6c82e54a61b..0f1ddbb3041 100644--- a/zerver/actions/users.py+++ b/zerver/actions/users.py@@ -549,7 +549,7 @@ def send_stream_events_for_role_update() -> None:current_accessible_streams = get_streams_for_user(user_profile,- include_all=user_profile.is_realm_admin,+ include_all=True,include_web_public=True,)@@ -623,7 +623,7 @@ def do_change_user_role(previously_accessible_streams = get_streams_for_user(user_profile,include_web_public=True,- include_all=user_profile.is_realm_admin,+ include_all=True,)user_profile.role = valuediff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex ef06683c61d..c56a60d892a 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -777,7 +777,7 @@ def fetch_initial_state_data(state["streams"] = do_get_streams(user_profile,include_web_public=True,- include_all=user_profile.is_realm_admin,+ include_all=True,anonymous_group_membership=realm_groups_data.anonymous_group_membership,)else:diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex 9953618ead1..deb3ade1469 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -2573,9 +2573,20 @@ class NormalActionsTest(BaseAction):# for email being passed into this next function.self.user_profile.refresh_from_db()- self.make_stream("Test private stream", invite_only=True)- self.subscribe(self.example_user("othello"), "Test private stream")+ self.make_stream("private_stream_1", invite_only=True)+ self.subscribe(self.example_user("othello"), "private_stream_1")++ private_stream_2 = self.make_stream("private_stream_2", invite_only=True)+ do_change_stream_group_based_setting(+ private_stream_2,+ "can_administer_channel_group",+ UserGroupMembersDict(direct_members=[self.user_profile.id], direct_subgroups=[]),+ acting_user=self.user_profile,+ )+ # There should only be one stream create event here for+ # `private_stream_1` since user already had access to+ # `private_stream_2` via `can_administer_channel_group.`self.do_test_change_role(UserProfile.ROLE_MEMBER,UserProfile.ROLE_REALM_ADMINISTRATOR,@@ -2587,6 +2598,9 @@ class NormalActionsTest(BaseAction):check_subscription_peer_add,],)+ # There should only be one stream delete event here for+ # `private_stream_1` since user already had access to+ # `private_stream_2` via `can_administer_channel_group.`self.do_test_change_role(UserProfile.ROLE_REALM_ADMINISTRATOR,UserProfile.ROLE_MEMBER,@@ -2608,9 +2622,20 @@ class NormalActionsTest(BaseAction):do_change_user_role(self.user_profile, UserProfile.ROLE_MEMBER, acting_user=None)- self.make_stream("Test private stream", invite_only=True)- self.subscribe(self.example_user("othello"), "Test private stream")+ self.make_stream("private_stream_1", invite_only=True)+ self.subscribe(self.example_user("othello"), "private_stream_1")++ private_stream_2 = self.make_stream("private_stream_2", invite_only=True)+ do_change_stream_group_based_setting(+ private_stream_2,+ "can_administer_channel_group",+ UserGroupMembersDict(direct_members=[self.user_profile.id], direct_subgroups=[]),+ acting_user=self.user_profile,+ )+ # There should only be one stream create event here for+ # `private_stream_1` since user already had access to+ # `private_stream_2` via `can_administer_channel_group.`self.do_test_change_role(UserProfile.ROLE_MEMBER,UserProfile.ROLE_REALM_OWNER,@@ -2622,6 +2647,9 @@ class NormalActionsTest(BaseAction):check_subscription_peer_add,],)+ # There should only be one stream delete event here for+ # `private_stream_1` since user already had access to+ # `private_stream_2` via `can_administer_channel_group.`self.do_test_change_role(UserProfile.ROLE_REALM_OWNER,UserProfile.ROLE_MEMBER,