fix initial `count`
This commit is contained in:
parent
893d08f8ae
commit
0ced78661c
|
@ -44,13 +44,18 @@ export class ActivityCenter {
|
||||||
const chatUuid = notification.value.chatUuid
|
const chatUuid = notification.value.chatUuid
|
||||||
|
|
||||||
const chat = unreadChats.get(chatUuid)
|
const chat = unreadChats.get(chatUuid)
|
||||||
if (chat) {
|
let count = chat?.count ?? 0
|
||||||
const shouldIncrement = notification.isMention || notification.isReply
|
|
||||||
if (shouldIncrement) {
|
if (notification.isMention || notification.isReply) {
|
||||||
chat.count++
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('be:count', count)
|
||||||
|
|
||||||
|
if (chat) {
|
||||||
|
chat.count = count
|
||||||
} else {
|
} else {
|
||||||
unreadChats.set(chatUuid, { count: 0 })
|
unreadChats.set(chatUuid, { count })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue