more test fixes
This commit is contained in:
parent
7505c94986
commit
b09efcb5f3
2 changed files with 16 additions and 19 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue