Hoist variable declaration out of loop

(imported from commit 12d3ea280b4e089a829ba0a557c7803b2db1b15e)
This commit is contained in:
Leo Franchi 2013-10-07 15:39:40 -04:00
parent 72c7c5b836
commit b1a38d751c
1 changed files with 3 additions and 3 deletions

View File

@ -1603,14 +1603,14 @@ def add_subscriptions_backend(request, user_profile,
notifications_stream.name, "Streams", msg,
realm=notifications_stream.realm))
else:
msg = ("Hi there! %s just created a new stream '%s'. "
"To join, click the gear in the left-side streams list."
% (user_profile.full_name, created_streams[0].name))
for realm_user in get_active_user_profiles_by_realm(user_profile.realm):
# Don't announce to yourself or to people you explicitly added
# (who will get the notification above instead).
if realm_user.email in principals or realm_user.email == user_profile.email:
continue
msg = ("Hi there! %s just created a new stream '%s'. "
"To join, click the gear in the left-side streams list."
% (user_profile.full_name, created_streams[0].name))
notifications.append(internal_prep_message("notification-bot@zulip.com",
"private",
realm_user.email, "", msg))