logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: d6dd394cd9446a972bef4071d304b1edb63ec057
parent 8cb7f7d6d2eb35bfa73a0e5dc2f3ca59100890eb
Author: Tusooa Zhu <tusooa@kazv.moe>
Date:   Thu, 17 Mar 2022 18:04:35 -0400

Do not count unread announcements for guests

Diffstat:

Msrc/modules/announcements.js6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 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)