diff --git a/js/models/conversations.js b/js/models/conversations.js index a1dc803a75ab..bb4cdcca30ab 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -786,7 +786,8 @@ promises.push(m.markRead()); return { sender : m.get('source'), - timestamp : m.get('sent_at') + timestamp : m.get('sent_at'), + hasErrors : Boolean(m.get('errors')) }; }.bind(this)); @@ -804,6 +805,15 @@ }.bind(this)); promises.push(promise); + // If a message has errors, we don't want to send anything out about it. + // read syncs - let's wait for a client that really understands the message + // to mark it read. we'll mark our local error read locally, though. + // read receipts - here we can run into infinite loops, where each time the + // conversation is viewed, another error message shows up for the contact + read = read.filter(function(item) { + return !item.hasErrors; + }); + if (read.length && options.sendReadReceipts) { console.log('Sending', read.length, 'read receipts'); promises.push(textsecure.messaging.syncReadMessages(read));