From 52c8f687ccdf0b60d48d2a46bed2b4cfd0d1a9b5 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Wed, 13 Jul 2022 15:45:13 +0530 Subject: [PATCH] streams: Rename admin_access_required to unsubscribing_others. This commit renames admin_access_required parameter of list_to_streams function to unsubscribing_others since that parameter is used and passed as True only when calling the function while unsubscribing others and in further commits we would allow non-admins too to unsubscribe others based on can_remove_subscribers_group setting. --- zerver/lib/streams.py | 4 ++-- zerver/views/streams.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py index ef8c54e1ff..e2739672f5 100644 --- a/zerver/lib/streams.py +++ b/zerver/lib/streams.py @@ -625,7 +625,7 @@ def list_to_streams( streams_raw: Collection[StreamDict], user_profile: UserProfile, autocreate: bool = False, - admin_access_required: bool = False, + unsubscribing_others: bool = False, ) -> Tuple[List[Stream], List[Stream]]: """Converts list of dicts to a list of Streams, validating input in the process @@ -654,7 +654,7 @@ def list_to_streams( missing_stream_dicts: List[StreamDict] = [] existing_stream_map = bulk_get_streams(user_profile.realm, stream_set) - if admin_access_required: + if unsubscribing_others: existing_recipient_ids = [stream.recipient_id for stream in existing_stream_map.values()] subs = Subscription.objects.filter( user_profile=user_profile, recipient_id__in=existing_recipient_ids, active=True diff --git a/zerver/views/streams.py b/zerver/views/streams.py index d301bddf60..351af47d2d 100644 --- a/zerver/views/streams.py +++ b/zerver/views/streams.py @@ -424,7 +424,7 @@ def remove_subscriptions_backend( streams_as_dict.append({"name": stream_name.strip()}) streams, __ = list_to_streams( - streams_as_dict, user_profile, admin_access_required=removing_someone_else + streams_as_dict, user_profile, unsubscribing_others=removing_someone_else ) if principals: