mirror of https://github.com/zulip/zulip.git
events: Update subscriber list on peer_remove for never subscribed stream.
We now update the subscriber list on peer_remove event for never subscribed streams also.
This commit is contained in:
parent
af9b153ee3
commit
733d26aef2
|
@ -727,7 +727,7 @@ def apply_event(state: Dict[str, Any],
|
|||
elif event['op'] == 'peer_remove':
|
||||
stream_ids = set(event["stream_ids"])
|
||||
user_ids = set(event["user_ids"])
|
||||
for sub_dict in [state["subscriptions"], state['unsubscribed']]:
|
||||
for sub_dict in [state["subscriptions"], state['unsubscribed'], state['never_subscribed']]:
|
||||
for sub in sub_dict:
|
||||
if sub["stream_id"] in stream_ids:
|
||||
subscribers = set(sub["subscribers"]) - user_ids
|
||||
|
|
|
@ -1483,6 +1483,17 @@ class NormalActionsTest(BaseAction):
|
|||
events = self.verify_action(action, num_events=2)
|
||||
check_subscription_peer_add('events[1]', events[1])
|
||||
|
||||
def test_remove_other_user_never_subscribed(self) -> None:
|
||||
self.subscribe(self.example_user("othello"), "test_stream")
|
||||
stream = get_stream("test_stream", self.user_profile.realm)
|
||||
|
||||
action = lambda: bulk_remove_subscriptions(
|
||||
[self.example_user('othello')],
|
||||
[stream],
|
||||
get_client("website"))
|
||||
events = self.verify_action(action)
|
||||
check_subscription_peer_remove('events[0]', events[0])
|
||||
|
||||
def test_do_delete_message_stream(self) -> None:
|
||||
hamlet = self.example_user('hamlet')
|
||||
msg_id = self.send_stream_message(hamlet, "Verona")
|
||||
|
|
Loading…
Reference in New Issue