lint
This commit is contained in:
parent
e582b23ad7
commit
35a1dec8a5
4 changed files with 56 additions and 53 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
||||||
import { muteFilterHits } from '../status_parser/status_parser.js'
|
import { muteFilterHits } from '../status_parser/status_parser.js'
|
||||||
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||||
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'
|
||||||
|
|
||||||
|
|
@ -108,7 +108,8 @@ export const filteredNotificationsFromStore = (
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unseenNotificationsFromStore = (store, notificationVisibility) => {
|
export const unseenNotificationsFromStore = (store, notificationVisibility) => {
|
||||||
const ignoreInactionableSeen = useSyncConfigStore().mergedConfig.ignoreInactionableSeen
|
const ignoreInactionableSeen =
|
||||||
|
useSyncConfigStore().mergedConfig.ignoreInactionableSeen
|
||||||
|
|
||||||
return filteredNotificationsFromStore(store, notificationVisibility).filter(
|
return filteredNotificationsFromStore(store, notificationVisibility).filter(
|
||||||
({ seen, type }) => {
|
({ seen, type }) => {
|
||||||
|
|
@ -189,7 +190,10 @@ export const prepareNotificationObject = (notification, i18n) => {
|
||||||
return notifObj
|
return notifObj
|
||||||
}
|
}
|
||||||
|
|
||||||
export const countExtraNotifications = (mergedConfig) => {
|
export const countExtraNotifications = (store) => {
|
||||||
|
const rootGetters = store.rootGetters || store.getters
|
||||||
|
const mergedConfig = useSyncConfigStore().mergedConfig
|
||||||
|
|
||||||
if (!mergedConfig.showExtraNotifications) {
|
if (!mergedConfig.showExtraNotifications) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,7 @@ describe('Gallery', () => {
|
||||||
|
|
||||||
// No grouping of non-image items
|
// No grouping of non-image items
|
||||||
local = {
|
local = {
|
||||||
attachments: [
|
attachments: [{ type: 'plain' }, { type: 'plain' }, { type: 'plain' }],
|
||||||
{ type: 'plain' },
|
|
||||||
{ type: 'plain' },
|
|
||||||
{ type: 'plain' },
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||||
{ minimal: true, items: [{ type: 'plain' }] },
|
{ minimal: true, items: [{ type: 'plain' }] },
|
||||||
|
|
@ -174,11 +170,7 @@ describe('Gallery', () => {
|
||||||
|
|
||||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||||
{
|
{
|
||||||
items: [
|
items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }],
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{ items: [{ type: 'image' }] },
|
{ items: [{ type: 'image' }] },
|
||||||
{ audio: true, items: [{ type: 'audio' }] },
|
{ audio: true, items: [{ type: 'audio' }] },
|
||||||
|
|
@ -202,11 +194,7 @@ describe('Gallery', () => {
|
||||||
// https:/.pleroma.social-fe/-_requests#note_98514
|
// https:/.pleroma.social-fe/-_requests#note_98514
|
||||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||||
{
|
{
|
||||||
items: [
|
items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }],
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
items: [
|
items: [
|
||||||
|
|
@ -233,18 +221,10 @@ describe('Gallery', () => {
|
||||||
|
|
||||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||||
{
|
{
|
||||||
items: [
|
items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }],
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
items: [
|
items: [{ type: 'image' }, { type: 'image' }, { type: 'image' }],
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
{ type: 'image' },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{ items: [{ type: 'image' }, { type: 'image' }] },
|
{ items: [{ type: 'image' }, { type: 'image' }] },
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,13 @@ describe('NotificationUtils', () => {
|
||||||
type: 'like',
|
type: 'like',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
expect(NotificationUtils.filteredNotificationsFromStore(store, {
|
expect(
|
||||||
mentions: false,
|
NotificationUtils.filteredNotificationsFromStore(store, {
|
||||||
likes: true,
|
mentions: false,
|
||||||
repeats: true,
|
likes: true,
|
||||||
})).to.eql(
|
repeats: true,
|
||||||
expected,
|
}),
|
||||||
)
|
).to.eql(expected)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ describe('NotificationUtils', () => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
const expected = [
|
const expected = [
|
||||||
{
|
{
|
||||||
|
|
@ -90,13 +90,13 @@ describe('NotificationUtils', () => {
|
||||||
seen: false,
|
seen: false,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
expect(NotificationUtils.unseenNotificationsFromStore(store, {
|
expect(
|
||||||
likes: true,
|
NotificationUtils.unseenNotificationsFromStore(store, {
|
||||||
repeats: true,
|
likes: true,
|
||||||
mentions: false,
|
repeats: true,
|
||||||
})).to.eql(
|
mentions: false,
|
||||||
expected,
|
}),
|
||||||
)
|
).to.eql(expected)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,11 @@ describe('The UserHighlight store', () => {
|
||||||
describe('set', () => {
|
describe('set', () => {
|
||||||
it('should set preference and update journal log accordingly', () => {
|
it('should set preference and update journal log accordingly', () => {
|
||||||
const store = useUserHighlightStore()
|
const store = useUserHighlightStore()
|
||||||
store.set({ user: 'highlight@testing', value: { 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['highlight@testing']).to.eql({
|
||||||
|
user: 'highlight@testing',
|
||||||
|
type: 'test',
|
||||||
|
})
|
||||||
expect(store.highlight._journal.length).to.eql(1)
|
expect(store.highlight._journal.length).to.eql(1)
|
||||||
expect(store.highlight._journal[0]).to.eql({
|
expect(store.highlight._journal[0]).to.eql({
|
||||||
user: 'highlight@testing',
|
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.set({ user: 'highlight@testing.xyz', value: { type: 'test' } })
|
store.set({ user: 'highlight@testing.xyz', value: { type: 'test' } })
|
||||||
store.updateCache({ username: '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.length).to.eql(1)
|
||||||
expect(store.highlight._journal[0]).to.eql({
|
expect(store.highlight._journal[0]).to.eql({
|
||||||
user: 'highlight@testing.xyz',
|
user: 'highlight@testing.xyz',
|
||||||
operation: 'set',
|
operation: 'set',
|
||||||
args: [{
|
args: [
|
||||||
user: 'highlight@testing.xyz',
|
{
|
||||||
type: 'test',
|
user: 'highlight@testing.xyz',
|
||||||
}],
|
type: 'test',
|
||||||
|
},
|
||||||
|
],
|
||||||
// should have A timestamp, we don't really care what it is
|
// should have A timestamp, we don't really care what it is
|
||||||
timestamp: store.highlight._journal[0].timestamp,
|
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.set({ user: 'a@test.xyz', value: { type: 'foo' } })
|
store.set({ user: 'a@test.xyz', value: { type: 'foo' } })
|
||||||
store.updateCache({ username: 'test' })
|
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)
|
expect(store.highlight._journal.length).to.eql(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -156,7 +167,11 @@ describe('The UserHighlight store', () => {
|
||||||
_mergePrefs(
|
_mergePrefs(
|
||||||
// RECENT
|
// 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: [
|
_journal: [
|
||||||
{
|
{
|
||||||
user: 'b@test.xyz',
|
user: 'b@test.xyz',
|
||||||
|
|
@ -174,7 +189,11 @@ describe('The UserHighlight store', () => {
|
||||||
},
|
},
|
||||||
// STALE
|
// 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: [
|
_journal: [
|
||||||
{
|
{
|
||||||
user: 'a@test.xyz',
|
user: 'a@test.xyz',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue