mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
Fixes https://chat.zulip.org/#narrow/channel/101-design/topic/permissions.20for.20admin.20to.20unsubscribe.20others/near/2060197 Non realm admin users were not able to view private channels they were an administrator of but not subscribed to it. This commit changes that. We also made changes for those users to be able to see the subscribers list. The increase in query count in test_home and test_event_system can be mitigated by only fetching recursive user group ids when needed within the `validate_user_access_to_subscribers_helper` function. But that would require refactoring that function to handle multiple streams and subscriptions at once, along with changing how that function is used at different places, which might be an exercise better left as a follow up. We have optimised the code a little bit by not fetching the group ids in case the current user is a realm admin. We are fetching channel_admin_ids and users belonging to can_add_subscribers_group directly in stream_subscription.py without using the helper function `get_user_ids_with_metadata_access_via_permission_groups`. This is due to a cyclic dependency and we will move `bulk_get_subscriber_peer_info` to another file in the next commit.