Always update unreadCount for conversations

This commit is contained in:
Josh Perez 2021-05-17 12:52:09 -04:00 committed by Scott Nonnenberg
parent 794d910d4e
commit 215d90fbe8
3 changed files with 29 additions and 19 deletions

View file

@ -13,7 +13,6 @@ export async function markConversationRead(
}
): Promise<boolean> {
const { id: conversationId } = conversationAttrs;
window.Whisper.Notifications.removeBy({ conversationId });
const [unreadMessages, unreadReactions] = await Promise.all([
window.Signal.Data.getUnreadByConversationAndMarkRead(
@ -27,10 +26,19 @@ export async function markConversationRead(
),
]);
window.log.info('markConversationRead', {
conversationId,
newestUnreadId,
unreadMessages: unreadMessages.length,
unreadReactions: unreadReactions.length,
});
if (!unreadMessages.length && !unreadReactions.length) {
return false;
}
window.Whisper.Notifications.removeBy({ conversationId });
const unreadReactionSyncData = new Map<
string,
{