diff --git a/js/background.js b/js/background.js index 8d661fc4..c2e19d8a 100644 --- a/js/background.js +++ b/js/background.js @@ -238,8 +238,8 @@ return; } - messages.fetchSentAt(timestamp).then(function() { - groups.fetchGroups(pushMessage.source).then(function() { + groups.fetchGroups(pushMessage.source).then(function() { + messages.fetchSentAt(timestamp).then(function() { var found = false; messages.where({type: 'outgoing'}).forEach(function(message) { var deliveries = message.get('delivered') || 0; @@ -264,8 +264,6 @@ receipts.add({ timestamp: timestamp, source: pushMessage.source }); return; }); - }).fail(function() { - console.log('got delivery receipt for unknown message', pushMessage.source, timestamp); }); } })(); diff --git a/js/models/messages.js b/js/models/messages.js index 044dd271..e0c4ecc1 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -352,8 +352,8 @@ }); } - conversation.save().then(function() { - message.save().then(function() { + message.save().then(function() { + conversation.save().then(function() { conversation.trigger('newmessage', message); conversation.notify(message); });