remove related dispatches

This commit is contained in:
Henry Jameson 2026-08-20 21:00:36 +03:00
commit ae5984d2f1
29 changed files with 260 additions and 236 deletions

View file

@ -543,7 +543,7 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
window.highlightConfig = useUserHighlightStore()
FaviconService.initFaviconService()
initServiceWorker(store)
initServiceWorker()
window.addEventListener('focus', () => updateFocus())

View file

@ -71,7 +71,8 @@ const chatNew = {
this.loading = true
this.userIds = []
this.$store
.dispatch('search', { q: query, resolve: true, type: 'accounts' })
this.useSearchStore()
.search({ q: query, resolve: true, type: 'accounts' })
.then((data) => {
this.loading = false
this.userIds = data.accounts.map((a) => a.id)

View file

@ -17,10 +17,10 @@ const DomainMuteCard = {
},
methods: {
unmuteDomain() {
return this.$store.dispatch('unmuteDomain', this.domain)
return useUsersStore().unmuteDomain(this.domain)
},
muteDomain() {
return this.$store.dispatch('muteDomain', this.domain)
return useUsersStore().muteDomain(this.domain)
},
},
}

View file

@ -1,3 +1,5 @@
import { useSearchStore } from 'src/stores/search.js'
/**
* suggest - generates a suggestor function to be used by emoji-input
* data: object providing source information for specific types of suggestions:
@ -77,7 +79,7 @@ export const suggestUsers = ({ dispatch, state }) => {
let timeout = null
let cancelUserSearch = null
const userSearch = (query) => dispatch('searchUsers', { query })
const userSearch = (query) => useSearchStore().searchUsers({ query })
const debounceUserSearch = (query) => {
cancelUserSearch?.()
return new Promise((resolve, reject) => {

View file

@ -55,10 +55,11 @@ const FollowRequestCard = {
id: this.user.id,
credentials: useOAuthStore().token,
})
// TODO fix
this.$store.dispatch('removeFollowRequest', this.user)
const notifId = this.findFollowRequestNotificationId()
this.$store.dispatch('markSingleNotificationAsSeen', { id: notifId })
useNotificationsStore().markSingleNotificationAsSeen(notifId)
this.hideApproveConfirmDialog()
},
denyUser() {
@ -75,7 +76,8 @@ const FollowRequestCard = {
id: this.user.id,
credentials: useOAuthStore().token,
}).then(() => {
this.$store.dispatch('dismissNotificationLocal', { id: notifId })
useNotificationsStore().dismissNotificationLocal(notifId)
// TODO fix
this.$store.dispatch('removeFollowRequest', this.user)
})
this.hideDenyConfirmDialog()

View file

@ -32,8 +32,8 @@ const ListsUserSearch = {
this.loading = true
this.$emit('loading')
this.userIds = []
this.$store
.dispatch('search', {
this.useSearchStore()
.search({
q: query,
resolve: true,
type: 'accounts',

View file

@ -12,6 +12,7 @@ import { useAnnouncementsStore } from 'src/stores/announcements.js'
import { useChatsStore } from 'src/stores/chats.js'
import { useInstanceStore } from 'src/stores/instance.js'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useNotificationsStore } from 'src/stores/notifications.js'
import { useUsersStore } from 'src/stores/users.js'
import { library } from '@fortawesome/fontawesome-svg-core'
@ -149,7 +150,7 @@ const MobileNav = {
this.hideConfirmLogout()
},
markNotificationsAsSeen() {
this.$store.dispatch('markNotificationsAsSeen')
useNotificationsStore().markNotificationsAsSeen()
},
onScroll({ target: { scrollTop, clientHeight, scrollHeight } }) {
this.notificationsAtTop = scrollTop > 0

View file

@ -15,6 +15,7 @@ import {
import { useInstanceStore } from 'src/stores/instance.js'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useNotificationsStore } from 'src/stores/notifications.js'
import { useOAuthStore } from 'src/stores/oauth.js'
import { useStatusesStore } from 'src/stores/statuses.js'
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
@ -150,10 +151,9 @@ const Notification = {
id: this.user.id,
credentials: useOAuthStore().token,
})
// TODO Fix this
this.$store.dispatch('removeFollowRequest', this.user)
this.$store.dispatch('markSingleNotificationAsSeen', {
id: this.notification.id,
})
useNotificationsStore().markSingleNotificationAsSeen(this.notification.id)
this.hideApproveConfirmDialog()
},
denyUser() {
@ -168,9 +168,8 @@ const Notification = {
id: this.user.id,
credentials: useOAuthStore().token,
}).then(() => {
this.$store.dispatch('dismissNotificationLocal', {
id: this.notification.id,
})
useNotificationsStore().dismissNotificationLocal(this.notification.id)
// TODO Fix this
this.$store.dispatch('removeFollowRequest', this.user)
})
this.hideDenyConfirmDialog()

View file

@ -17,7 +17,6 @@ import { useChatsStore } from 'src/stores/chats.js'
import { useInterfaceStore } from 'src/stores/interface.js'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useNotificationsStore } from 'src/stores/notifications.js'
import { useUsersStore } from 'src/stores/users.js'
import { library } from '@fortawesome/fontawesome-svg-core'
import {

View file

@ -93,8 +93,8 @@ export default {
this.$emit('update:id', notice[3])
} else if (value) {
this.loading = true
this.$store
.dispatch('search', {
this.useSearchStore()
.search({
q: value,
resolve: true,
offset: 0,

View file

@ -1,6 +1,7 @@
import { defineAsyncComponent } from 'vue'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useUsersStore } from 'src/stores/users.js'
export default {
props: ['user', 'relationship'],
@ -43,9 +44,9 @@ export default {
},
doRemoveUserFromFollowers() {
this.inProgress = true
this.$store
.dispatch('removeUserFromFollowers', this.relationship.id)
.then(() => {
useUsersStore()
.removeUserFromFollowers(this.relationship.id)
.finally(() => {
this.inProgress = false
})
this.hideConfirmRemoveUserFromFollowers()

View file

@ -4,6 +4,7 @@ import Conversation from 'src/components/conversation/conversation.vue'
import FollowCard from 'src/components/follow_card/follow_card.vue'
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import { useSearchStore } from 'src/stores/search.js'
import { useStatusesStore } from 'src/stores/statuses.js'
import { useUsersStore } from 'src/stores/users.js'
@ -79,8 +80,8 @@ const Search = {
this.lastStatusFetchCount = 0
}
this.$store
.dispatch('search', {
useSearchStore()
.search({
q: query,
resolve: true,
offset: this.statusesOffset,

View file

@ -13,6 +13,7 @@ import UnitSetting from '../helpers/unit_setting.vue'
import { useInstanceStore } from 'src/stores/instance.js'
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
import { useInterfaceStore } from 'src/stores/interface.js'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useOAuthStore } from 'src/stores/oauth.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
@ -139,10 +140,10 @@ const ComposingTab = {
clearCache(key) {
clearCache(key)
.then(() => {
this.$store.dispatch('settingsSaved', { success: true })
useInterfaceStore().settingsSaved({ success: true })
})
.catch((error) => {
this.$store.dispatch('settingsSaved', { error })
useInterfaceStore().settingsSaved({ error })
})
},
tooSmall() {

View file

@ -4,6 +4,7 @@ import BooleanSetting from '../helpers/boolean_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
import { useInstanceStore } from 'src/stores/instance.js'
import { useInterfaceStore } from 'src/stores/interface.js'
import { cacheKey, clearCache, emojiCacheKey } from 'src/services/sw/sw.js'
@ -35,10 +36,10 @@ const VersionTab = {
clearCache(key) {
clearCache(key)
.then(() => {
this.$store.dispatch('settingsSaved', { success: true })
useInterfaceStore().settingsSaved({ success: true })
})
.catch((error) => {
this.$store.dispatch('settingsSaved', { error })
useInterfaceStore().settingsSaved({ error })
})
},
},

View file

@ -12,6 +12,7 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import { useInstanceStore } from 'src/stores/instance.js'
import { useOAuthStore } from 'src/stores/oauth.js'
import { useOAuthTokensStore } from 'src/stores/oauth_tokens.js'
import { useSearchStore } from 'src/stores/search.js'
import { useUsersStore } from 'src/stores/users.js'
import { importBlocks, importFollows } from 'src/api/user.js'
@ -106,8 +107,8 @@ const MutesAndBlocks = {
})
},
queryUserIds(query) {
return this.$store
.dispatch('searchUsers', { query })
return useSearchStore()
.searchUsers({ query })
.then((users) => map(users, 'id'))
},
blockUsers(ids) {
@ -133,7 +134,7 @@ const MutesAndBlocks = {
})
},
unmuteDomains(domains) {
return this.$store.dispatch('unmuteDomains', domains)
return useUsersStore().unmuteDomains(domains)
},
},
}

View file

@ -564,7 +564,7 @@ const Status = {
this.mainStatus.rebloggedBy &&
this.mainStatus.rebloggedBy.length !== num
) {
this.$store.dispatch('fetchRepeats', this.status.id)
useStatusesStore().fetchRepeats(this.status.id)
}
},
'mainStatus.fave_num': function (num) {
@ -574,7 +574,7 @@ const Status = {
this.mainStatus.favoritedBy &&
this.mainStatus.favoritedBy.length !== num
) {
this.$store.dispatch('fetchFavs', this.status.id)
useStatusesStore().fetchFavs(this.status.id)
}
},
isSuspendable: function (suspend) {

View file

@ -50,7 +50,7 @@ export default {
emits: ['emojiPickerShown'],
mounted() {
if (this.button.name === 'mute') {
this.$store.dispatch('fetchDomainMutes')
useUsersStore().fetchDomainMutes()
}
},
data() {

View file

@ -3,6 +3,7 @@ import { mapState } from 'pinia'
import Popover from 'src/components/popover/popover.vue'
import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
import { useStatusesStore } from 'src/stores/statuses.js'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faChevronRight, faFolder } from '@fortawesome/free-solid-svg-icons'
@ -30,8 +31,8 @@ const StatusBookmarkFolderMenu = {
toggleFolder(id) {
const value = id === this.folderId ? null : id
this.$store
.dispatch('bookmark', { id: this.status.id, bookmark_folder_id: value })
useStatusesStore()
.bookmark(this.status.id, value)
.then(() => this.$emit('success'))
.catch((err) => this.$emit('error', err.error.error))
},

View file

@ -3,6 +3,7 @@ import { mapState } from 'pinia'
import Popover from 'src/components/popover/popover.vue'
import { useListsStore } from 'src/stores/lists.js'
import { useUsersStore } from 'src/stores/users.js'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faChevronRight } from '@fortawesome/free-solid-svg-icons'
@ -18,7 +19,7 @@ const UserListMenu = {
Popover,
},
created() {
this.$store.dispatch('fetchUserInLists', this.user.id)
useUsersStore().fetchUserInLists(this.user.id)
},
computed: {
...mapState(useListsStore, {
@ -49,7 +50,7 @@ const UserListMenu = {
if (!response.ok) {
return
}
this.$store.dispatch('fetchUserInLists', this.user.id)
useUsersStore().fetchUserInLists(this.user.id)
})
} else {
useListsStore()
@ -58,7 +59,7 @@ const UserListMenu = {
if (!response.ok) {
return
}
this.$store.dispatch('fetchUserInLists', this.user.id)
useUsersStore().fetchUserInLists(this.user.id)
})
}
},

View file

@ -1,5 +1,7 @@
import PanelLoading from 'src/components/panel_loading/panel_loading.vue'
import { useUsersStore } from 'src/stores/users.js'
const UserNote = {
props: {
user: Object,
@ -29,11 +31,8 @@ const UserNote = {
finalizeEditing() {
this.frozen = true
this.$store
.dispatch('editUserNote', {
id: this.user.id,
comment: this.localNote,
})
useUsersStore()
.editUserNote(this.user.id, this.localNote)
.then(() => {
this.frozen = false
this.editing = false

View file

@ -61,30 +61,3 @@ export const piniaPushNotificationsPlugin = ({ store }) => {
}
})
}
// TODO make it work with pinia
export const vuexPushNotificationsPlugin = (store) => {
store.subscribe((mutation, state) => {
// Initial state
const vapidPublicKey = useInstanceStore().vapidPublicKey
const enabled = useMergedConfigStore().mergedConfig.webPushNotifications
const permissionGranted =
useInterfaceStore().notificationPermission === 'granted'
const permissionPresent =
useInterfaceStore().notificationPermission !== undefined
const user = state.users.currentUser
if (!permissionPresent || !vapidPublicKey) return
if (
mutation.type === 'setCurrentUser' ||
mutation.type === 'clearCurrentUser'
) {
if (user && permissionGranted && enabled) {
return store.dispatch('registerPushNotifications')
} else {
return store.dispatch('unregisterPushNotifications')
}
}
})
}

View file

@ -1,6 +1,7 @@
import { map } from 'lodash'
import { useStatusesStore } from 'src/stores/statuses.js'
import { useTimelinesStore } from 'src/stores/timelines.js'
import { useUsersStore } from 'src/stores/users.js'
import {
@ -75,10 +76,13 @@ const editStatus = ({
mediaIds,
contentType,
})
.then(({ data }) => {
store.dispatch('addNewStatuses', {
.then(({ data, timestamp }) => {
useStatusesStore().addNewStatuses({
statuses: [data],
timestamp,
})
useTimelinesStore().addStatusesToTimeline('friends', undefined, {
statuses: [data],
timeline: 'friends',
showImmediately: true,
noIdUpdate: true, // To prevent missing notices on next pull.
})

View file

@ -1,3 +1,5 @@
import { useNotificationsStore } from 'src/stores/notifications.js'
/* global process */
function urlBase64ToUint8Array(base64String) {
const padding = '='.repeat((4 - (base64String.length % 4)) % 4)
@ -94,16 +96,15 @@ function sendSubscriptionToBackEnd(
return responseData
})
}
export async function initServiceWorker(store) {
export async function initServiceWorker() {
if (!isSWSupported()) return
await getOrCreateServiceWorker()
navigator.serviceWorker.addEventListener('message', (event) => {
const { dispatch } = store
const { type, ...rest } = event.data
switch (type) {
case 'notificationClicked':
dispatch('notificationClicked', { id: rest.id })
useNotificationsStore().notificationClicked(rest.id)
}
})
}

View file

@ -1,4 +1,3 @@
import { createTestingPinia } from '@pinia/testing'
import { config } from '@vue/test-utils'
import { createMemoryHistory, createRouter } from 'vue-router'
import VueVirtualScroller from 'vue-virtual-scroller'

View file

@ -3,7 +3,6 @@ import { createTestingPinia } from '@pinia/testing'
createTestingPinia()
import { createMemoryHistory, createRouter } from 'vue-router'
import { createStore } from 'vuex'
import routes from 'src/boot/routes'

View file

@ -2,12 +2,12 @@ import { createTestingPinia } from '@pinia/testing'
import { flushPromises, mount } from '@vue/test-utils'
import { setActivePinia } from 'pinia'
import { nextTick } from 'vue'
import { useUsersStore } from 'src/stores/users.js'
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
import { $t, mountOpts, waitForEvent } from '../../../fixtures/setup_test'
import { useMergedConfigStore } from 'src/stores/merged_config.js'
import { useUsersStore } from 'src/stores/users.js'
const autoSaveOrNot = (caseFn, caseTitle, runFn) => {
caseFn(`${caseTitle} with auto-save`, function () {

View file

@ -1,9 +1,9 @@
import { createTestingPinia } from '@pinia/testing'
import { setActivePinia } from 'pinia'
import { mount, shallowMount } from '@vue/test-utils'
import { mountOpts } from '../../../fixtures/setup_test'
import { setActivePinia } from 'pinia'
import RichContent from 'src/components/rich_content/rich_content.jsx'
import { mountOpts } from '../../../fixtures/setup_test'
const attentions = []
@ -30,15 +30,18 @@ describe('RichContent', () => {
it('renders simple post without exploding', () => {
const html = p('Hello world!')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(html))
})
@ -46,30 +49,36 @@ describe('RichContent', () => {
it('unescapes everything as needed', () => {
const html = [p('Testing 'em all'), 'Testing 'em all'].join('')
const expected = [p("Testing 'em all"), "Testing 'em all"].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
it('replaces mention with mentionsline', () => {
const html = p(makeMention('John'), ' how are you doing today?')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(
compwrap(p(mentionsLine(1), ' how are you doing today?')),
@ -93,15 +102,18 @@ describe('RichContent', () => {
),
].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -128,15 +140,18 @@ describe('RichContent', () => {
].join(''),
].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(strippedHtml))
})
@ -148,15 +163,18 @@ describe('RichContent', () => {
'<span class="greentext">&gt;any year</span>',
].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(expected))
})
@ -164,15 +182,18 @@ describe('RichContent', () => {
it('Does not add greentext and cyantext if setting is set to false', () => {
const html = ['&gt;preordering videogames', '&gt;any year'].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(html))
})
@ -184,15 +205,18 @@ describe('RichContent', () => {
'<anonymous-stub shortcode="spurdo" islocal="true" class="emoji img" src="about:blank" title=":spurdo:" alt=":spurdo:"></anonymous-stub>',
)
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [{ url: 'about:blank', shortcode: 'spurdo' }],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [{ url: 'about:blank', shortcode: 'spurdo' }],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -200,15 +224,18 @@ describe('RichContent', () => {
it("Doesn't add nonexistent emoji to post", () => {
const html = p('Lol :lol:')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(html))
})
@ -227,15 +254,18 @@ describe('RichContent', () => {
'<span class="greentext">&gt;quote</span>',
].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(expected))
})
@ -249,15 +279,18 @@ describe('RichContent', () => {
].join('<br>')
const expected = ['Bruh', 'Bruh', mentionsLine(3), 'Bruh'].join('<br>')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -284,15 +317,18 @@ describe('RichContent', () => {
' </p>',
].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -330,15 +366,18 @@ describe('RichContent', () => {
p('Testing'),
].join('')
const wrapper = mount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = mount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(
wrapper
@ -402,15 +441,18 @@ describe('RichContent', () => {
'Testing',
].join('')
const wrapper = mount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = mount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(
wrapper
@ -450,15 +492,18 @@ describe('RichContent', () => {
'</p>',
].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -495,13 +540,16 @@ describe('RichContent', () => {
const ptest = (handleLinks, vhtml) => {
const t0 = performance.now()
const wrapper = mount(TestComponent, mountOpts({
props: {
attentions,
handleLinks,
vhtml,
},
}))
const wrapper = mount(
TestComponent,
mountOpts({
props: {
attentions,
handleLinks,
vhtml,
},
}),
)
const t1 = performance.now()

View file

@ -1,8 +1,8 @@
import { setActivePinia } from 'pinia'
import { createTestingPinia } from '@pinia/testing'
import { setActivePinia } from 'pinia'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
import { useNotificationsStore } from 'src/stores/notifications.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
import * as NotificationUtils from 'src/services/notification_utils/notification_utils.js'

View file

@ -85,14 +85,6 @@ const mockStatusNotification = ({
from_profile: user,
})
const DEFAULT_OPTIONS = (method = 'POST') => ({
method,
credentials: 'same-origin',
headers: {
Accept: 'application/json',
},
})
describe('Notifications store', () => {
beforeEach(() => {
vi.useFakeTimers()
@ -328,7 +320,6 @@ describe('Notifications store', () => {
vi.stubGlobal('fetch', mockFetch)
const store = useNotificationsStore()
const mockedNotification = mockStatusNotification()
store.addNewNotifications({
timestamp: 1337,
@ -366,7 +357,6 @@ describe('Notifications store', () => {
vi.stubGlobal('fetch', mockFetch)
const store = useNotificationsStore()
const mockedNotification = mockStatusNotification()
// FormData is weird to test
store.addNewNotifications({