Fix tracebacks sending messages nobody will receive.

(imported from commit afe3d7465f105015f7fa8247ab3cba7476b89fc2)
This commit is contained in:
Tim Abbott 2012-10-29 19:17:26 -04:00
parent 9c5136c8cc
commit 0fcf1db00a
1 changed files with 6 additions and 0 deletions

View File

@ -699,6 +699,12 @@ def notify_new_message(request, handler):
if not validate_notify(request, handler):
return
# If a message for some reason has no recipients (e.g. it is sent
# by a bot to a stream that nobody is subscribed to), just skip
# the message gracefully
if request.POST["users"] == "":
return
# FIXME: better query
users = [UserProfile.objects.get(id=user)
for user in request.POST['users'].split(',')]