diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 9230bb3c0..d3301c325 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -55,11 +55,13 @@ const MobileNav = { return unseenNotificationsFromStore( this.$store, useSyncConfigStore().mergedConfig.notificationVisibility, + useSyncConfigStore().mergedConfig.ignoreInactionableSeen, ) }, unseenNotificationsCount() { return ( - this.unseenNotifications.length + countExtraNotifications(this.$store) + this.unseenNotifications.length + + countExtraNotifications(this.$store, useSyncConfigStore().mergedConfig) ) }, unseenCount() { diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 6d21ce0ea..d1d01052a 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -111,7 +111,10 @@ const Notifications = { return useSyncConfigStore().mergedConfig.ignoreInactionableSeen }, extraNotificationsCount() { - return countExtraNotifications(this.$store) + return countExtraNotifications( + this.$store, + useSyncConfigStore().mergedConfig, + ) }, unseenCountTitle() { return ( diff --git a/src/components/settings_modal/tabs/layout_tab.vue b/src/components/settings_modal/tabs/layout_tab.vue index e0082ab0d..acae859a0 100644 --- a/src/components/settings_modal/tabs/layout_tab.vue +++ b/src/components/settings_modal/tabs/layout_tab.vue @@ -107,8 +107,8 @@
_) .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 ignoreInactionableSeen = useSyncConfigStore().mergedConfig.ignoreInactionableSeen - +export const unseenNotificationsFromStore = ( + store, + notificationVisibility, + ignoreInactionableSeen, +) => { return filteredNotificationsFromStore(store, notificationVisibility).filter( ({ seen, type }) => { if (!ignoreInactionableSeen) return !seen @@ -189,7 +189,9 @@ export const prepareNotificationObject = (notification, i18n) => { return notifObj } -export const countExtraNotifications = (mergedConfig) => { +export const countExtraNotifications = (store, mergedConfig) => { + const rootGetters = store.rootGetters || store.getters + if (!mergedConfig.showExtraNotifications) { return 0 } diff --git a/test/unit/specs/components/gallery.spec.js b/test/unit/specs/components/gallery.spec.js index 3e7aa0de2..367bab0b4 100644 --- a/test/unit/specs/components/gallery.spec.js +++ b/test/unit/specs/components/gallery.spec.js @@ -103,11 +103,7 @@ describe('Gallery', () => { // No grouping of non-image items local = { - attachments: [ - { type: 'plain' }, - { type: 'plain' }, - { type: 'plain' }, - ], + attachments: [{ type: 'plain' }, { type: 'plain' }, { type: 'plain' }], } expect(Gallery.computed.rows.call(local)).to.eql([ { minimal: true, items: [{ type: 'plain' }] }, @@ -174,11 +170,7 @@ describe('Gallery', () => { expect(Gallery.computed.rows.call(local)).to.eql([ { - items: [ - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - ], + items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }], }, { items: [{ type: 'image' }] }, { audio: true, items: [{ type: 'audio' }] }, @@ -202,11 +194,7 @@ describe('Gallery', () => { // https:/.pleroma.social-fe/-_requests#note_98514 expect(Gallery.computed.rows.call(local)).to.eql([ { - items: [ - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - ], + items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }], }, { items: [ @@ -233,18 +221,10 @@ describe('Gallery', () => { expect(Gallery.computed.rows.call(local)).to.eql([ { - items: [ - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - ], + items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }], }, { - items: [ - { type: 'image' }, - { type: 'image' }, - { type: 'image' }, - ], + items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }], }, { items: [{ type: 'image' }, { type: 'image' }] }, ]) 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 dbdd3d660..20c9379c6 100644 --- a/test/unit/specs/services/notification_utils/notification_utils.spec.js +++ b/test/unit/specs/services/notification_utils/notification_utils.spec.js @@ -53,13 +53,13 @@ describe('NotificationUtils', () => { type: 'like', }, ] - expect(NotificationUtils.filteredNotificationsFromStore(store, { - mentions: false, - likes: true, - repeats: true, - })).to.eql( - expected, - ) + expect( + NotificationUtils.filteredNotificationsFromStore(store, { + mentions: false, + likes: true, + repeats: true, + }), + ).to.eql(expected) }) }) @@ -81,7 +81,7 @@ describe('NotificationUtils', () => { }, ], }, - } + }, } const expected = [ { @@ -90,13 +90,13 @@ describe('NotificationUtils', () => { seen: false, }, ] - expect(NotificationUtils.unseenNotificationsFromStore(store, { - likes: true, - repeats: true, - mentions: false, - })).to.eql( - expected, - ) + expect( + NotificationUtils.unseenNotificationsFromStore(store, { + likes: true, + repeats: true, + mentions: false, + }), + ).to.eql(expected) }) }) }) diff --git a/test/unit/specs/stores/user_highlight.spec.js b/test/unit/specs/stores/user_highlight.spec.js index d58626876..742eec522 100644 --- a/test/unit/specs/stores/user_highlight.spec.js +++ b/test/unit/specs/stores/user_highlight.spec.js @@ -43,8 +43,11 @@ describe('The UserHighlight store', () => { describe('set', () => { it('should set preference and update journal log accordingly', () => { const store = useUserHighlightStore() - store.set({ user: 'highlight@testing', value: { type: 'test' }}) - expect(store.highlight['highlight@testing']).to.eql({ user: 'highlight@testing', type: 'test' }) + store.set({ user: 'highlight@testing', value: { type: 'test' } }) + expect(store.highlight['highlight@testing']).to.eql({ + user: 'highlight@testing', + type: 'test', + }) expect(store.highlight._journal.length).to.eql(1) expect(store.highlight._journal[0]).to.eql({ user: 'highlight@testing', @@ -60,15 +63,20 @@ describe('The UserHighlight store', () => { store.set({ user: 'highlight@testing.xyz', value: { type: 'test' } }) store.set({ user: 'highlight@testing.xyz', value: { type: 'test' } }) store.updateCache({ username: 'test' }) - expect(store.highlight['highlight@testing.xyz']).to.eql({ user: 'highlight@testing.xyz', type: 'test' }) + expect(store.highlight['highlight@testing.xyz']).to.eql({ + user: 'highlight@testing.xyz', + type: 'test', + }) expect(store.highlight._journal.length).to.eql(1) expect(store.highlight._journal[0]).to.eql({ user: 'highlight@testing.xyz', operation: 'set', - args: [{ - user: 'highlight@testing.xyz', - type: 'test', - }], + args: [ + { + user: 'highlight@testing.xyz', + type: 'test', + }, + ], // should have A timestamp, we don't really care what it is timestamp: store.highlight._journal[0].timestamp, }) @@ -79,7 +87,10 @@ describe('The UserHighlight store', () => { store.set({ user: 'a@test.xyz', value: { type: 'foo' } }) store.set({ user: 'a@test.xyz', value: { type: 'foo' } }) store.updateCache({ username: 'test' }) - expect(store.highlight['a@test.xyz']).to.eql({ user: 'a@test.xyz', type: 'foo' }) + expect(store.highlight['a@test.xyz']).to.eql({ + user: 'a@test.xyz', + type: 'foo', + }) expect(store.highlight._journal.length).to.eql(1) }) }) @@ -156,7 +167,11 @@ describe('The UserHighlight store', () => { _mergePrefs( // RECENT { - highlight: { 'a@test.xyz': 1, 'b@test.xyz': 0, 'c@test.xyz': true }, + highlight: { + 'a@test.xyz': 1, + 'b@test.xyz': 0, + 'c@test.xyz': true, + }, _journal: [ { user: 'b@test.xyz', @@ -174,7 +189,11 @@ describe('The UserHighlight store', () => { }, // STALE { - highlight: { 'a@test.xyz': 1, 'b@test.xyz': 1, 'c@test.xyz': false }, + highlight: { + 'a@test.xyz': 1, + 'b@test.xyz': 1, + 'c@test.xyz': false, + }, _journal: [ { user: 'a@test.xyz',