From a81672f2a6bf6b61b05f2a9ca8cdc6c8a02c259d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 7 Nov 2024 10:50:13 +0100 Subject: [PATCH] fix(notifications): fix dismiss function for tmc warnings (#1956) * fix(notifications): fix dismiss function for tmc warnings Signed-off-by: Stefan Dej * refactor: remove magic number in getNotificationsOverheadDrivers getter Signed-off-by: Stefan Dej --------- Signed-off-by: Stefan Dej --- src/store/gui/notifications/getters.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/store/gui/notifications/getters.ts b/src/store/gui/notifications/getters.ts index 6bd197bed..ccde3ea86 100644 --- a/src/store/gui/notifications/getters.ts +++ b/src/store/gui/notifications/getters.ts @@ -436,7 +436,17 @@ export const getters: GetterTree = { } }) - return notifications + // get all dismissed tmcwarnings and convert it to a string[] + const tmcwarningsDismisses = getters['getDismissByCategory']('tmcwarning').map( + (dismiss: GuiNotificationStateDismissEntry) => { + return `tmcwarning/${dismiss.id}` + } + ) + + // return filtered tmcwarnings + return notifications.filter((entry) => { + return !tmcwarningsDismisses.includes(entry.id) + }) }, getDismiss: (state, getters, rootState) => {