Do not count unread announcements for guests

This commit is contained in:
Tusooa Zhu 2022-03-17 18:04:35 -04:00 committed by tusooa
parent 8cb7f7d6d2
commit d6dd394cd9
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,11 @@ export const mutations = {
}
export const getters = {
unreadAnnouncementCount (state) {
unreadAnnouncementCount (state, _getters, rootState) {
if (!rootState.users.currentUser) {
return 0
}
return state.announcements.reduce((acc, cur) => {
return (!cur.inactive && !cur.read) ? acc + 1 : acc
}, 0)