Revert "notification_utils.js"
This reverts commit 67059addfe64d3cf531a4797a3b9d38174f622e4.
This commit is contained in:
parent
85976a61b8
commit
76d3ec1b39
2 changed files with 11 additions and 17 deletions
|
|
@ -3,7 +3,6 @@ import { muteFilterHits } from '../status_parser/status_parser.js'
|
||||||
|
|
||||||
import { useAnnouncementsStore } from 'src/stores/announcements'
|
import { useAnnouncementsStore } from 'src/stores/announcements'
|
||||||
import { useI18nStore } from 'src/stores/i18n.js'
|
import { useI18nStore } from 'src/stores/i18n.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
|
|
||||||
import FaviconService from 'src/services/favicon_service/favicon_service.js'
|
import FaviconService from 'src/services/favicon_service/favicon_service.js'
|
||||||
|
|
||||||
|
|
@ -20,7 +19,8 @@ export const notificationsFromStore = (store) => store.state.notifications.data
|
||||||
export const visibleTypes = (store) => {
|
export const visibleTypes = (store) => {
|
||||||
// When called from within a module we need rootGetters to access wider scope
|
// When called from within a module we need rootGetters to access wider scope
|
||||||
// however when called from a component (i.e. this.$store) we already have wider scope
|
// however when called from a component (i.e. this.$store) we already have wider scope
|
||||||
const { notificationVisibility } = useSyncConfigStore().mergedConfig
|
const rootGetters = store.rootGetters || store.getters
|
||||||
|
const { notificationVisibility } = rootGetters.mergedConfig
|
||||||
|
|
||||||
return [
|
return [
|
||||||
notificationVisibility.likes && 'like',
|
notificationVisibility.likes && 'like',
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,6 @@
|
||||||
import { createTestingPinia } from '@pinia/testing'
|
|
||||||
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
|
|
||||||
import * as NotificationUtils from 'src/services/notification_utils/notification_utils.js'
|
import * as NotificationUtils from 'src/services/notification_utils/notification_utils.js'
|
||||||
|
|
||||||
describe('NotificationUtils', () => {
|
describe('NotificationUtils', () => {
|
||||||
beforeEach(() => {
|
|
||||||
const store = useSyncConfigStore(createTestingPinia())
|
|
||||||
store.mergedConfig = {
|
|
||||||
notificationVisibility: {
|
|
||||||
likes: true,
|
|
||||||
repeats: true,
|
|
||||||
mentions: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('filteredNotificationsFromStore', () => {
|
describe('filteredNotificationsFromStore', () => {
|
||||||
it('should return sorted notifications with configured types', () => {
|
it('should return sorted notifications with configured types', () => {
|
||||||
const store = {
|
const store = {
|
||||||
|
|
@ -40,6 +25,15 @@ describe('NotificationUtils', () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
mergedConfig: {
|
||||||
|
notificationVisibility: {
|
||||||
|
likes: true,
|
||||||
|
repeats: true,
|
||||||
|
mentions: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
const expected = [
|
const expected = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue