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) {
var envelope = ev.proto;
var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber());
var attributes = {};
if (e.name === 'IncomingIdentityKeyError') {
message.save({ errors : [e] }).then(function() {
ConversationController.updateInbox();
notifyConversation(message);
});
return;
attributes = { errors : [e] };
} else if (e.message !== 'Bad MAC') {
message.save({ errors : [ _.pick(e, ['name', 'message'])]}).then(function() {
ConversationController.updateInbox();
attributes = { errors : [ _.pick(e, ['name', 'message'])]};
}
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);
});
return;
}
});
}
console.error(e);