From 4f58733d824b98420d2ea32675e5b3d4da7980bb Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Tue, 14 Nov 2023 17:38:12 +0530 Subject: [PATCH] events: Remove deactivated streams from subscriptions field. We did not remove the objects for deactivated streams from subscriptions field in apply_event. We need to do this because we do not send "subscription/remove" events to subscribers when deactivating streams. --- zerver/lib/events.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zerver/lib/events.py b/zerver/lib/events.py index f61b082102..e9086802af 100644 --- a/zerver/lib/events.py +++ b/zerver/lib/events.py @@ -1070,6 +1070,12 @@ def apply_event( s for s in state["streams"] if s["stream_id"] not in deleted_stream_ids ] + state["subscriptions"] = [ + stream + for stream in state["subscriptions"] + if stream["stream_id"] not in deleted_stream_ids + ] + state["unsubscribed"] = [ stream for stream in state["unsubscribed"]