From 691ad7fcfcb7bc516cce2aa342651de433e47266 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 26 Jul 2016 19:00:46 -0700 Subject: [PATCH] maybe_get_subscriber_emails: Pass user_profile through. --- zerver/lib/actions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 5f50c2e6ea..b2e4a57b2c 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1192,13 +1192,13 @@ def get_subscriber_emails(stream, requesting_user=None): subscriptions = subscriptions_query.values('user_profile__email') return [subscription['user_profile__email'] for subscription in subscriptions] -def maybe_get_subscriber_emails(stream): - # type: (Stream) -> List[text_type] +def maybe_get_subscriber_emails(stream, user_profile): + # type: (Stream, UserProfile) -> List[text_type] """ Alternate version of get_subscriber_emails that takes a Stream object only (not a name), and simply returns an empty list if unable to get a real subscriber list (because we're on the MIT realm). """ try: - subscribers = get_subscriber_emails(stream) + subscribers = get_subscriber_emails(stream, requesting_user=user_profile) except JsonableError: subscribers = [] return subscribers @@ -1408,7 +1408,7 @@ def do_add_subscription(user_profile, stream, no_log=False): send_event(event, active_user_ids(user_profile.realm)) if did_subscribe: - emails_by_stream = {stream.id: maybe_get_subscriber_emails(stream)} + emails_by_stream = {stream.id: maybe_get_subscriber_emails(stream, user_profile)} notify_subscriptions_added(user_profile, [(subscription, stream)], lambda stream: emails_by_stream[stream.id], no_log)