Browse files

notify_subscriptions_*: Fix use of leaked stream variable.

While I believe this actually produced correct output since users are
always subscribed to streams within their realm, this code was
definitely wrong.

Discovered using the mypy type-checking tool.
  • Loading branch information...
timabbott committed Jan 23, 2016
1 parent 6c5cee2 commit e9f39922a09d2aad90de63a349abe408e93edd4d
Showing with 2 additions and 2 deletions.
  1. +2 −2 zerver/lib/
@@ -1135,7 +1135,7 @@ def notify_subscriptions_added(user_profile, sub_pairs, stream_emails, no_log=Fa
log_event({'type': 'subscription_added',
'names': [ for sub, stream in sub_pairs],
- 'domain': stream.realm.domain})
+ 'domain': user_profile.realm.domain})
# Send a notification to the user who subscribed.
payload = [dict(,
@@ -1305,7 +1305,7 @@ def notify_subscriptions_removed(user_profile, streams, no_log=False):
log_event({'type': 'subscription_removed',
'names': [ for stream in streams],
- 'domain': stream.realm.domain})
+ 'domain': user_profile.realm.domain})
payload = [dict(, for stream in streams]
event = dict(type="subscription", op="remove",

0 comments on commit e9f3992

Please sign in to comment.