do_send_message: use JSON for the user list instead of joining/splitting with commas

(imported from commit 85d94ca647d0e6707f4f96e2b7a7b330f76db9d9)
This commit is contained in:
Zev Benjamin 2012-12-03 15:59:22 -05:00
parent 2907c3ca01
commit f4898ea490
2 changed files with 2 additions and 2 deletions

View File

@ -535,7 +535,7 @@ def do_send_message(message, no_log=False):
secret = settings.SHARED_SECRET,
message = message.id,
rendered = simplejson.dumps(rendered),
users = ','.join(str(user.id) for user in recipients)))
users = simplejson.dumps([str(user.id) for user in recipients])))
class Subscription(models.Model):
user_profile = models.ForeignKey(UserProfile)

View File

@ -678,7 +678,7 @@ def notify_new_message(request):
# FIXME: better query
users = [UserProfile.objects.get(id=user)
for user in request.POST['users'].split(',')]
for user in simplejson.loads(request.POST['users'])]
message = Message.objects.get(id=request.POST['message'])
# Cause message.to_dict() to return the dicts already rendered in the other process.