Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
events: Update subscriber list on peer_remove for never subscribed stream.
sahil839733d26aef211
diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex 9a5ba58a0a9..5c225e123f4 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -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_idsdiff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex ea48b9fcbea..487a13a2d88 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -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")