Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Pass realm to notify_subscriptions_removed.

Steve Howellebbd5f168b3d
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index 7b8e108a112..1a9a48c4f19 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -4171,11 +4171,13 @@ def get_available_notification_sounds() -> List[str]:
return sorted(available_notification_sounds)
-def notify_subscriptions_removed(user_profile: UserProfile, streams: Iterable[Stream]) -> None:
+def notify_subscriptions_removed(
+ realm: Realm, user_profile: UserProfile, streams: Iterable[Stream]
+) -> None:
payload = [dict(name=stream.name, stream_id=stream.id) for stream in streams]
event = dict(type="subscription", op="remove", subscriptions=payload)
- send_event(user_profile.realm, event, [user_profile.id])
+ send_event(realm, event, [user_profile.id])
SubAndRemovedT = Tuple[List[Tuple[UserProfile, Stream]], List[Tuple[UserProfile, Stream]]]
@@ -4264,7 +4266,7 @@ def bulk_remove_subscriptions(
for user_profile in users:
if len(streams_by_user[user_profile.id]) == 0:
continue
- notify_subscriptions_removed(user_profile, streams_by_user[user_profile.id])
+ notify_subscriptions_removed(our_realm, user_profile, streams_by_user[user_profile.id])
event = {
"type": "mark_stream_messages_as_read",