From 319ff6eba21e77f14e61853a3416853e09b479e0 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Fri, 17 Jun 2022 16:08:24 +0530 Subject: [PATCH] events: Update stream objects in "unsubscribed" and "never_subscribed" lists. --- zerver/lib/events.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/zerver/lib/events.py b/zerver/lib/events.py index bbc3e26561..aa70e4dec9 100644 --- a/zerver/lib/events.py +++ b/zerver/lib/events.py @@ -923,17 +923,22 @@ def apply_event( if event["op"] == "update": # For legacy reasons, we call stream data 'subscriptions' in # the state var here, for the benefit of the JS code. - for obj in state["subscriptions"]: - if obj["name"].lower() == event["name"].lower(): - obj[event["property"]] = event["value"] - if event["property"] == "description": - obj["rendered_description"] = event["rendered_description"] - if event.get("history_public_to_subscribers") is not None: - obj["history_public_to_subscribers"] = event[ - "history_public_to_subscribers" - ] - if event.get("is_web_public") is not None: - obj["is_web_public"] = event["is_web_public"] + for sub_list in [ + state["subscriptions"], + state["unsubscribed"], + state["never_subscribed"], + ]: + for obj in sub_list: + if obj["name"].lower() == event["name"].lower(): + obj[event["property"]] = event["value"] + if event["property"] == "description": + obj["rendered_description"] = event["rendered_description"] + if event.get("history_public_to_subscribers") is not None: + obj["history_public_to_subscribers"] = event[ + "history_public_to_subscribers" + ] + if event.get("is_web_public") is not None: + obj["is_web_public"] = event["is_web_public"] # Also update the pure streams data if "streams" in state: for stream in state["streams"]: