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)
|
||||||
|
let count = chat?.count ?? 0
|
||||||
|
|
||||||
|
if (notification.isMention || notification.isReply) {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('be:count', count)
|
||||||
|
|
||||||
if (chat) {
|
if (chat) {
|
||||||
const shouldIncrement = notification.isMention || notification.isReply
|
chat.count = count
|
||||||
if (shouldIncrement) {
|
|
||||||
chat.count++
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
unreadChats.set(chatUuid, { count: 0 })
|
unreadChats.set(chatUuid, { count })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue