Mark delivered messages as sent

In rare cases, a race between delivery receipts and outgoing message
requests can cause the sent flag to be reversed. Fix by marking messages
sent at the same time they are marked delivered.

// FREEBIE
This commit is contained in:
lilia 2015-10-20 18:54:22 -07:00
parent b65adc14dc
commit a32780d174

View file

@ -243,7 +243,7 @@
var deliveries = message.get('delivered') || 0;
var conversationId = message.get('conversationId');
if (conversationId === pushMessage.source || groups.get(conversationId)) {
message.save({delivered: deliveries + 1}).then(
message.save({delivered: deliveries + 1, sent: true}).then(
// notify frontend listeners
updateConversation.bind(null, conversationId)
);