Mark relevant convos active/unread on key conflict

// FREEBIE
This commit is contained in:
lilia 2015-09-15 14:40:37 -07:00
parent 15d84199c2
commit df99da15c6

View file

@ -130,19 +130,21 @@
if (ev.proto) { if (ev.proto) {
var envelope = ev.proto; var envelope = ev.proto;
var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber()); var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber());
var attributes = {};
if (e.name === 'IncomingIdentityKeyError') { if (e.name === 'IncomingIdentityKeyError') {
message.save({ errors : [e] }).then(function() { attributes = { errors : [e] };
ConversationController.updateInbox();
notifyConversation(message);
});
return;
} else if (e.message !== 'Bad MAC') { } else if (e.message !== 'Bad MAC') {
message.save({ errors : [ _.pick(e, ['name', 'message'])]}).then(function() { attributes = { errors : [ _.pick(e, ['name', 'message'])]};
ConversationController.updateInbox(); }
message.save(attributes).then(function() {
ConversationController.findOrCreatePrivateById(message.get('conversationId')).then(function(conversation) {
conversation.save({
active_at: Date.now(),
unreadCount: conversation.get('unreadCount') + 1
});
notifyConversation(message); notifyConversation(message);
}); });
return; });
}
} }
console.error(e); console.error(e);