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.

stream: Rename can_administer_channel to reflect what it checks.

Shubham Padia6852142b0046
diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py
index 2f29e8686a2..30f521a853a 100644
--- a/zerver/lib/streams.py
+++ b/zerver/lib/streams.py
@@ -439,7 +439,7 @@ def check_stream_access_for_delete_or_update(
if sub is None and stream.invite_only:
raise JsonableError(error)
- if can_administer_channel(stream, user_profile):
+ if can_administer_accessible_channel(stream, user_profile):
return
raise CannotAdministerChannelError
@@ -828,7 +828,9 @@ def get_streams_to_which_user_cannot_add_subscribers(
return result
-def can_administer_channel(channel: Stream, user_profile: UserProfile) -> bool:
+def can_administer_accessible_channel(channel: Stream, user_profile: UserProfile) -> bool:
+ # IMPORTANT: This function expects its callers to have already
+ # checked that the user can access the provided channel.
group_allowed_to_administer_channel = channel.can_administer_channel_group
assert group_allowed_to_administer_channel is not None
return user_has_permission_for_group_setting(