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.

streams: Change flow in filter_stream_authorization.

Clara Dantasfda94a49c1e8
diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py
index 5307097738a..c4a80bf7044 100644
--- a/zerver/lib/streams.py
+++ b/zerver/lib/streams.py
@@ -397,10 +397,11 @@ def filter_stream_authorization(user_profile: UserProfile,
if stream.id in streams_subscribed:
continue
- # Users are not authorized for invite_only streams, and guest
- # users are not authorized for any streams
- if stream.invite_only or user_profile.is_guest:
- unauthorized_streams.append(stream)
+ # Members and administrators are authorized for public streams
+ if not stream.invite_only and not user_profile.is_guest:
+ continue
+
+ unauthorized_streams.append(stream)
authorized_streams = [stream for stream in streams if
stream.id not in {stream.id for stream in unauthorized_streams}]