mirror of
https://github.com/nextcloud/spreed.git
synced 2025-08-15 20:33:18 +00:00
feat: emit new event "talk:unread:updated" when number of unread messages changes
Signed-off-by: Markus Stoll <markus.stoll@junidas.de>
This commit is contained in:
35
src/App.vue
35
src/App.vue
@ -95,6 +95,33 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
unreadCountsMap() {
|
||||
return this.$store.getters.conversationsList.reduce((acc, conversation) => {
|
||||
if (conversation.isArchived) {
|
||||
// Do not consider archived conversations in counting
|
||||
return acc
|
||||
}
|
||||
|
||||
if (conversation.unreadMessages > 0) {
|
||||
acc.conversations++
|
||||
acc.messages += conversation.unreadMessages
|
||||
}
|
||||
|
||||
if (conversation.unreadMention) {
|
||||
acc.mentions++
|
||||
}
|
||||
|
||||
if (conversation.unreadMentionDirect) {
|
||||
acc.mentionsDirect++
|
||||
}
|
||||
return acc
|
||||
}, {
|
||||
conversations: 0,
|
||||
messages: 0,
|
||||
mentions: 0,
|
||||
mentionsDirect: 0,
|
||||
})
|
||||
},
|
||||
getUserId() {
|
||||
return this.$store.getters.getUserId()
|
||||
},
|
||||
@ -163,6 +190,14 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
unreadCountsMap: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(value) {
|
||||
emit('talk:unread:updated', value)
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
beforeCreate() {
|
||||
|
Reference in New Issue
Block a user