mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
stream: Rename can_administer_channel to reflect what it checks.
We've added a comment highlighting that the function does not check whether a user has access to the channel or not. Adding `accessible` to the function name further emphasises that.
This commit is contained in:
committed by
Tim Abbott
parent
bf5bdacf51
commit
6852142b00
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user