fix initial `count`

This commit is contained in:
Felicio Mununga 2022-08-24 10:51:26 +02:00
parent 893d08f8ae
commit 0ced78661c
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 10 additions and 5 deletions

View File

@ -44,13 +44,18 @@ export class ActivityCenter {
const chatUuid = notification.value.chatUuid
const chat = unreadChats.get(chatUuid)
if (chat) {
const shouldIncrement = notification.isMention || notification.isReply
if (shouldIncrement) {
chat.count++
let count = chat?.count ?? 0
if (notification.isMention || notification.isReply) {
count++
}
console.log('be:count', count)
if (chat) {
chat.count = count
} else {
unreadChats.set(chatUuid, { count: 0 })
unreadChats.set(chatUuid, { count })
}
}