From b09efcb5f3674ee897cd1ae22a6e1213598237d0 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 6 Mar 2026 17:10:56 +0200 Subject: [PATCH] more test fixes --- .../notification_utils/notification_utils.js | 12 ++++------ .../notification_utils.spec.js | 23 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index 95902daef..b412ba59b 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -1,7 +1,8 @@ import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js' import { muteFilterHits } from '../status_parser/status_parser.js' -import { useAnnouncementsStore } from 'src/stores/announcements' +import { useSyncConfigStore } from 'src/stores/sync_config.js' +import { useAnnouncementsStore } from 'src/stores/announcements.js' import { useI18nStore } from 'src/stores/i18n.js' import FaviconService from 'src/services/favicon_service/favicon_service.js' @@ -100,14 +101,14 @@ export const filteredNotificationsFromStore = ( .map((_) => _) .sort(sortById) // TODO implement sorting elsewhere and make it optional + console.log(types, visibleTypes(notificationVisibility)) return sortedNotifications.filter((notification) => (types || visibleTypes(notificationVisibility)).includes(notification.type), ) } export const unseenNotificationsFromStore = (store, notificationVisibility) => { - const rootGetters = store.rootGetters || store.getters - const ignoreInactionableSeen = rootGetters.mergedConfig.ignoreInactionableSeen + const ignoreInactionableSeen = useSyncConfigStore().mergedConfig.ignoreInactionableSeen return filteredNotificationsFromStore(store, notificationVisibility).filter( ({ seen, type }) => { @@ -188,10 +189,7 @@ export const prepareNotificationObject = (notification, i18n) => { return notifObj } -export const countExtraNotifications = (store) => { - const rootGetters = store.rootGetters || store.getters - const mergedConfig = rootGetters.mergedConfig - +export const countExtraNotifications = (mergedConfig) => { if (!mergedConfig.showExtraNotifications) { return 0 } diff --git a/test/unit/specs/services/notification_utils/notification_utils.spec.js b/test/unit/specs/services/notification_utils/notification_utils.spec.js index 0db318e3c..dbdd3d660 100644 --- a/test/unit/specs/services/notification_utils/notification_utils.spec.js +++ b/test/unit/specs/services/notification_utils/notification_utils.spec.js @@ -53,7 +53,11 @@ describe('NotificationUtils', () => { type: 'like', }, ] - expect(NotificationUtils.filteredNotificationsFromStore(store)).to.eql( + expect(NotificationUtils.filteredNotificationsFromStore(store, { + mentions: false, + likes: true, + repeats: true, + })).to.eql( expected, ) }) @@ -77,16 +81,7 @@ describe('NotificationUtils', () => { }, ], }, - }, - getters: { - mergedConfig: { - notificationVisibility: { - likes: true, - repeats: true, - mentions: false, - }, - }, - }, + } } const expected = [ { @@ -95,7 +90,11 @@ describe('NotificationUtils', () => { seen: false, }, ] - expect(NotificationUtils.unseenNotificationsFromStore(store)).to.eql( + expect(NotificationUtils.unseenNotificationsFromStore(store, { + likes: true, + repeats: true, + mentions: false, + })).to.eql( expected, ) })