mirror of https://github.com/zulip/zulip.git
refactor: Make acting_user a mandatory kwarg for bulk_remove_subscriptions.
This commit is contained in:
parent
0bf067b681
commit
bcc3bb03fe
|
@ -3557,7 +3557,8 @@ def bulk_remove_subscriptions(
|
|||
users: Iterable[UserProfile],
|
||||
streams: Iterable[Stream],
|
||||
acting_client: Client,
|
||||
acting_user: Optional[UserProfile] = None,
|
||||
*,
|
||||
acting_user: Optional[UserProfile],
|
||||
) -> SubAndRemovedT:
|
||||
|
||||
users = list(users)
|
||||
|
|
|
@ -965,7 +965,7 @@ Output:
|
|||
def unsubscribe(self, user_profile: UserProfile, stream_name: str) -> None:
|
||||
client = get_client("website")
|
||||
stream = get_stream(stream_name, user_profile.realm)
|
||||
bulk_remove_subscriptions([user_profile], [stream], client)
|
||||
bulk_remove_subscriptions([user_profile], [stream], client, acting_user=None)
|
||||
|
||||
# Subscribe to a stream by making an API request
|
||||
def common_subscribe_to_streams(
|
||||
|
|
|
@ -1570,7 +1570,7 @@ class NormalActionsTest(BaseAction):
|
|||
stream = get_stream("test_stream", self.user_profile.realm)
|
||||
|
||||
action = lambda: bulk_remove_subscriptions(
|
||||
[self.example_user("othello")], [stream], get_client("website")
|
||||
[self.example_user("othello")], [stream], get_client("website"), acting_user=None
|
||||
)
|
||||
events = self.verify_action(action)
|
||||
check_subscription_peer_remove("events[0]", events[0])
|
||||
|
@ -1968,7 +1968,7 @@ class SubscribeActionTest(BaseAction):
|
|||
# Now remove the first user, to test the normal unsubscribe flow and
|
||||
# 'peer_remove' event for subscribed streams.
|
||||
action = lambda: bulk_remove_subscriptions(
|
||||
[self.example_user("othello")], [stream], get_client("website")
|
||||
[self.example_user("othello")], [stream], get_client("website"), acting_user=None
|
||||
)
|
||||
events = self.verify_action(
|
||||
action,
|
||||
|
@ -1979,7 +1979,7 @@ class SubscribeActionTest(BaseAction):
|
|||
|
||||
# Now remove the user himself, to test the 'remove' event flow
|
||||
action = lambda: bulk_remove_subscriptions(
|
||||
[self.example_user("hamlet")], [stream], get_client("website")
|
||||
[self.example_user("hamlet")], [stream], get_client("website"), acting_user=None
|
||||
)
|
||||
events = self.verify_action(
|
||||
action, include_subscribers=include_subscribers, include_streams=False, num_events=2
|
||||
|
@ -2003,7 +2003,7 @@ class SubscribeActionTest(BaseAction):
|
|||
|
||||
# Remove the user to test 'peer_remove' event flow for unsubscribed stream.
|
||||
action = lambda: bulk_remove_subscriptions(
|
||||
[self.example_user("iago")], [stream], get_client("website")
|
||||
[self.example_user("iago")], [stream], get_client("website"), acting_user=None
|
||||
)
|
||||
events = self.verify_action(
|
||||
action,
|
||||
|
|
|
@ -3865,6 +3865,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
[user1, user2],
|
||||
[stream1, stream2, stream3, private],
|
||||
get_client("website"),
|
||||
acting_user=None,
|
||||
)
|
||||
|
||||
self.assert_length(query_count, 28)
|
||||
|
@ -3934,6 +3935,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
users=[mit_user],
|
||||
streams=streams,
|
||||
acting_client=get_client("website"),
|
||||
acting_user=None,
|
||||
)
|
||||
|
||||
self.assert_length(events, 0)
|
||||
|
|
Loading…
Reference in New Issue