From 7738ce87e6fb7257f81d2c5535960d9c2c497177 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 23 Feb 2026 19:55:43 +0200 Subject: [PATCH] more getters migrated --- src/components/emoji_input/emoji_input.js | 4 ++-- src/components/mention_link/mention_link.js | 4 +++- .../status_action_buttons/buttons_definitions.js | 5 +++-- src/components/timeago/timeago.js | 8 +++++--- src/modules/users.js | 3 +-- .../notifications_fetcher.service.js | 3 ++- src/services/timeline_fetcher/timeline_fetcher.service.js | 3 ++- src/stores/interface.js | 2 +- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 23de501de..ae46b0334 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -136,7 +136,7 @@ const EmojiInput = { return useSyncConfigStore().mergedConfig.padEmoji }, defaultCandidateIndex() { - return this.$store.getters.mergedConfig.autocompleteSelect ? 0 : -1 + return useSyncConfigStore().mergedConfig.autocompleteSelect ? 0 : -1 }, preText() { return this.modelValue.slice(0, this.caret) @@ -165,7 +165,7 @@ const EmojiInput = { }, languages() { return ensureFinalFallback( - this.$store.getters.mergedConfig.interfaceLanguage, + useSyncConfigStore().mergedConfig.interfaceLanguage, ) }, maybeLocalizedEmojiNamesAndKeywords() { diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js index 37c30355c..2f0b81b9e 100644 --- a/src/components/mention_link/mention_link.js +++ b/src/components/mention_link/mention_link.js @@ -1,5 +1,7 @@ import { defineAsyncComponent } from 'vue' import { mapGetters, mapState } from 'vuex' +import { mapState as mapPiniaState } from 'pinia' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { highlightClass, @@ -156,7 +158,7 @@ const MentionLink = { shouldFadeDomain() { return this.mergedConfig.mentionLinkFadeDomain }, - ...mapGetters(['mergedConfig']), + ...mapPiniaState(useSyncConfigStore, ['mergedConfig']), ...mapState({ currentUser: (state) => state.users.currentUser, }), diff --git a/src/components/status_action_buttons/buttons_definitions.js b/src/components/status_action_buttons/buttons_definitions.js index 20db7aa45..4ac98bd21 100644 --- a/src/components/status_action_buttons/buttons_definitions.js +++ b/src/components/status_action_buttons/buttons_definitions.js @@ -1,5 +1,6 @@ import { useEditStatusStore } from 'src/stores/editStatus.js' import { useInstanceStore } from 'src/stores/instance.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useReportsStore } from 'src/stores/reports.js' import { useStatusHistoryStore } from 'src/stores/statusHistory.js' @@ -52,7 +53,7 @@ export const BUTTONS = [ !PRIVATE_SCOPES.has(status.visibility)), toggleable: true, confirm: ({ status, getters }) => - !status.repeated && getters.mergedConfig.modalOnRepeat, + !status.repeated && useSyncConfigStore().mergedConfig.modalOnRepeat, confirmStrings: { title: 'status.repeat_confirm_title', body: 'status.repeat_confirm', @@ -227,7 +228,7 @@ export const BUTTONS = [ currentUser.privileges.includes('messages_delete')) ) }, - confirm: ({ getters }) => getters.mergedConfig.modalOnDelete, + confirm: ({ getters }) => useSyncConfigStore().mergedConfig.modalOnDelete, confirmStrings: { title: 'status.delete_confirm_title', body: 'status.delete_confirm', diff --git a/src/components/timeago/timeago.js b/src/components/timeago/timeago.js index efb92d4cd..9dc440e46 100644 --- a/src/components/timeago/timeago.js +++ b/src/components/timeago/timeago.js @@ -1,6 +1,8 @@ import * as DateUtils from 'src/services/date_utils/date_utils.js' import localeService from 'src/services/locale/locale.service.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + export default { name: 'Timeago', props: ['time', 'autoUpdate', 'longFormat', 'nowThreshold', 'templateKey'], @@ -13,17 +15,17 @@ export default { }, computed: { shouldUseAbsoluteTimeFormat() { - if (!this.$store.getters.mergedConfig.useAbsoluteTimeFormat) { + if (!useSyncConfigStore().mergedConfig.useAbsoluteTimeFormat) { return false } return ( DateUtils.durationStrToMs( - this.$store.getters.mergedConfig.absoluteTimeFormatMinAge, + useSyncConfigStore().mergedConfig.absoluteTimeFormatMinAge, ) <= this.relativeTimeMs ) }, time12hFormat() { - return this.$store.getters.mergedConfig.absoluteTimeFormat12h === '12h' + return useSyncConfigStore().mergedConfig.absoluteTimeFormat12h === '12h' }, browserLocale() { return localeService.internalToBrowserLocale(this.$i18n.locale) diff --git a/src/modules/users.js b/src/modules/users.js index a8752feff..d3e6eae7c 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -682,7 +682,6 @@ const users = { useInterfaceStore().setLastTimeline('public-timeline') useInterfaceStore().setLayoutWidth(windowWidth()) useInterfaceStore().setLayoutHeight(windowHeight()) - //useSyncConfigStore().clearSyncConfig() }) }, loginUser(store, accessToken) { @@ -780,7 +779,7 @@ const users = { dispatch('startFetchingFollowRequests') } - if (store.getters.mergedConfig.useStreamingApi) { + if (useSyncConfigStore().mergedConfig.useStreamingApi) { dispatch('fetchTimeline', { timeline: 'friends', since: null }) dispatch('fetchNotifications', { since: null }) dispatch('enableMastoSockets', true) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 73411b6a5..b9447276c 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -4,6 +4,7 @@ import { promiseInterval } from '../promise_interval/promise_interval.js' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' const update = ({ store, notifications, older }) => { store.dispatch('addNewNotifications', { notifications, older }) @@ -29,7 +30,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const { getters } = store const rootState = store.rootState || store.state const timelineData = rootState.notifications - const hideMutedPosts = getters.mergedConfig.hideMutedPosts + const hideMutedPosts = useSyncConfigStore().mergedConfig.hideMutedPosts if (useInstanceCapabilitiesStore().pleromaChatMessagesAvailable) { mastoApiNotificationTypes.add('pleroma:chat_mention') diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index da62f8b37..90dff144a 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -6,6 +6,7 @@ import { promiseInterval } from '../promise_interval/promise_interval.js' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' const update = ({ store, @@ -46,7 +47,7 @@ const fetchAndUpdate = ({ const rootState = store.rootState || store.state const { getters } = store const timelineData = rootState.statuses.timelines[camelCase(timeline)] - const { hideMutedPosts, replyVisibility } = getters.mergedConfig + const { hideMutedPosts, replyVisibility } = useSyncConfigStore().mergedConfig const loggedIn = !!rootState.users.currentUser if (older) { diff --git a/src/stores/interface.js b/src/stores/interface.js index e61186e7e..fc5fd36c8 100644 --- a/src/stores/interface.js +++ b/src/stores/interface.js @@ -186,7 +186,7 @@ export const useInterfaceStore = defineStore('interface', { const mobileLayout = width <= 800 const normalOrMobile = mobileLayout ? 'mobile' : 'normal' - const { thirdColumnMode } = window.vuex.getters.mergedConfig + const { thirdColumnMode } = useSyncConfigStore().mergedConfig if (thirdColumnMode === 'none' || !window.vuex.state.users.currentUser) { this.layoutType = normalOrMobile } else {