Added unread count badge .

pull/41/head
Mikunj 7 years ago
parent 061b8ab2cb
commit 745d0e82d4

@ -460,10 +460,13 @@
} }
} }
}, },
async onFriendRequestAccepted() { async onFriendRequestAccepted(updateUnread = false) {
// Make sure we don't keep incrementing the unread count
const unreadCount = this.isKeyExchangeCompleted() || !updateUnread ? {} : { unreadCount: this.get('unreadCount') + 1 };
this.set({ this.set({
friendRequestStatus: null, friendRequestStatus: null,
keyExchangeCompleted: true, keyExchangeCompleted: true,
...unreadCount
}); });
await window.Signal.Data.updateConversation(this.id, this.attributes, { await window.Signal.Data.updateConversation(this.id, this.attributes, {
@ -715,6 +718,7 @@
this.set({ this.set({
active_at: Date.now(), active_at: Date.now(),
timestamp: Date.now(), timestamp: Date.now(),
unreadCount: this.get('unreadCount') + 1,
}); });
await window.Signal.Data.updateConversation(this.id, this.attributes, { await window.Signal.Data.updateConversation(this.id, this.attributes, {

@ -1028,7 +1028,7 @@ MessageReceiver.prototype.extend({
); );
// Update the conversation // Update the conversation
await conversation.onFriendRequestAccepted(); await conversation.onFriendRequestAccepted(true);
} }
} }
} }

Loading…
Cancel
Save