From d6dd394cd9446a972bef4071d304b1edb63ec057 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 17 Mar 2022 18:04:35 -0400 Subject: [PATCH] Do not count unread announcements for guests --- src/modules/announcements.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/announcements.js b/src/modules/announcements.js index f04ba50e..876bcdaf 100644 --- a/src/modules/announcements.js +++ b/src/modules/announcements.js @@ -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)