Mark relevant convos active/unread on key conflict
// FREEBIE
This commit is contained in:
parent
15d84199c2
commit
df99da15c6
1 changed files with 11 additions and 9 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue