Index the presence data sent from Django to Tornado by ID.

(imported from commit 8ffb70562b49ba93c5b0927b34dc57a743d49564)
This commit is contained in:
Tim Abbott
2014-01-09 15:54:43 -05:00
parent e890f06c1c
commit e38ac2f9ac
2 changed files with 3 additions and 3 deletions

View File

@@ -356,7 +356,7 @@ def do_send_messages(messages):
presences = {}
for user_profile in message['active_recipients']:
if user_profile.email in user_presences:
presences[user_profile.email] = user_presences[user_profile.email]
presences[user_profile.id] = user_presences[user_profile.email]
data = dict(
type = 'new_message',

View File

@@ -109,12 +109,12 @@ def receiver_is_idle(user_profile, realm_presences):
# presence information in this case (and it's hard to get without an additional
# db query) so we simply don't try to guess if this cross-realm recipient
# has been idle for too long
if realm_presences is None or not user_profile.email in realm_presences:
if realm_presences is None or not user_profile.id in realm_presences:
return off_zulip
# If the most recent online status from a user is >1hr in the past, we notify
# them regardless of whether or not they have an open window
user_presence = realm_presences[user_profile.email]
user_presence = realm_presences[user_profile.id]
idle_too_long = False
newest = None
for client, status in user_presence.iteritems():