handle case of message getting read while processing missed_message

(imported from commit cd53efe3645f5dc8943becc2b8dbd3d607bb8eba)
This commit is contained in:
acrefoot
2013-12-02 15:00:31 -05:00
parent 00946f97df
commit da1466cfa9

View File

@@ -2000,8 +2000,9 @@ def do_send_missedmessage_events(user_profile, missed_messages):
def handle_push_notification(user_profile_id, missed_message):
user_profile = get_user_profile_by_id(user_profile_id)
message = UserMessage.objects.get(user_profile=user_profile,
message__id=missed_message['message_id'],
flags=~UserMessage.flags.read).message
message__id=missed_message['message_id']).message
if message.flags.read:
return
sender_str = message.sender.full_name
if user_profile.enable_offline_push_notifications and num_push_devices_for_user(user_profile):