diff --git a/src/App.js b/src/App.js index 273b3e3bc..6a842ae40 100644 --- a/src/App.js +++ b/src/App.js @@ -74,7 +74,7 @@ export default { created() { // Load the locale from the storage const val = useSyncConfigStore().mergedConfig.interfaceLanguage - this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val }) + useSyncConfigStore().setPreference({ path: 'simple.interfaceLanguage', value: val }) document.getElementById('modal').classList = ['-' + this.layoutType] // Create bound handlers diff --git a/src/components/extra_notifications/extra_notifications.js b/src/components/extra_notifications/extra_notifications.js index 85f4f72bd..673b7d6a5 100644 --- a/src/components/extra_notifications/extra_notifications.js +++ b/src/components/extra_notifications/extra_notifications.js @@ -61,8 +61,8 @@ const ExtraNotifications = { return useInterfaceStore().openSettingsModalTab('notifications') }, dismissConfigurationTip() { - return this.$store.dispatch('setOption', { - name: 'showExtraNotificationsTip', + return useSyncConfigStore().setPreference({ + path: 'simple.showExtraNotificationsTip', value: false, }) }, diff --git a/src/components/notifications/notification_filters.vue b/src/components/notifications/notification_filters.vue index 5508e03ac..3cd9c151e 100644 --- a/src/components/notifications/notification_filters.vue +++ b/src/components/notifications/notification_filters.vue @@ -124,8 +124,8 @@ export default { }, methods: { toggleNotificationFilter(type) { - this.$store.dispatch('setOption', { - name: 'notificationVisibility', + useSyncConfigStore().setPreference({ + path: 'simple.notificationVisibility', value: { ...this.filters, [type]: !this.filters[type], diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 3584c66ab..d147abb3b 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -819,8 +819,8 @@ const PostStatusForm = { } }, dismissScopeNotice() { - this.$store.dispatch('setOption', { - name: 'hideScopeNotice', + useSyncConfigStore().setPreference({ + path: 'simple.hideScopeNotice', value: true, }) }, diff --git a/src/components/quick_filter_settings/quick_filter_settings.js b/src/components/quick_filter_settings/quick_filter_settings.js index 84abeec72..fc7c9a9fc 100644 --- a/src/components/quick_filter_settings/quick_filter_settings.js +++ b/src/components/quick_filter_settings/quick_filter_settings.js @@ -20,8 +20,8 @@ const QuickFilterSettings = { }, methods: { setReplyVisibility(visibility) { - this.$store.dispatch('setOption', { - name: 'replyVisibility', + useSyncConfigStore().setPreference({ + path: 'simple.replyVisibility', value: visibility, }) this.$store.dispatch('queueFlushAll') @@ -87,9 +87,9 @@ const QuickFilterSettings = { }, set() { const value = !this.hideMedia - this.$store.dispatch('setOption', { name: 'hideAttachments', value }) - this.$store.dispatch('setOption', { - name: 'hideAttachmentsInConv', + useSyncConfigStore().setPreference({ path: 'simple.hideAttachments', value }) + useSyncConfigStore().setPreference({ + path: 'simple.hideAttachmentsInConv', value, }) }, @@ -100,8 +100,8 @@ const QuickFilterSettings = { }, set() { const value = !this.hideMutedPosts - this.$store.dispatch('setOption', { - name: 'hideFilteredStatuses', + useSyncConfigStore().setPreference({ + path: 'simple.hideFilteredStatuses', value, }) }, @@ -112,7 +112,7 @@ const QuickFilterSettings = { }, set() { const value = !this.muteBotStatuses - this.$store.dispatch('setOption', { name: 'muteBotStatuses', value }) + useSyncConfigStore().setPreference({ path: 'simple.muteBotStatuses', value }) }, }, muteSensitiveStatuses: { @@ -121,8 +121,8 @@ const QuickFilterSettings = { }, set() { const value = !this.muteSensitiveStatuses - this.$store.dispatch('setOption', { - name: 'muteSensitiveStatuses', + useSyncConfigStore().setPreference({ + path: 'simple.muteSensitiveStatuses', value, }) }, diff --git a/src/components/settings_modal/tabs/clutter_tab.js b/src/components/settings_modal/tabs/clutter_tab.js index f81ad7040..0386a844e 100644 --- a/src/components/settings_modal/tabs/clutter_tab.js +++ b/src/components/settings_modal/tabs/clutter_tab.js @@ -52,8 +52,8 @@ const ClutterTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - this.$store.dispatch('setOption', { - name: 'onMuteDefaultAction', + useSyncConfigStore().setPreference({ + path: 'simple.onMuteDefaultAction', value: realValue, }) }, @@ -72,8 +72,8 @@ const ClutterTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - this.$store.dispatch('setOption', { - name: 'onBlockDefaultAction', + useSyncConfigStore().setPreference({ + path: 'simple.onBlockDefaultAction', value: realValue, }) }, diff --git a/src/components/settings_modal/tabs/composing_tab.js b/src/components/settings_modal/tabs/composing_tab.js index e4ce20a1e..3327f0678 100644 --- a/src/components/settings_modal/tabs/composing_tab.js +++ b/src/components/settings_modal/tabs/composing_tab.js @@ -120,8 +120,8 @@ const ComposingTab = { return useSyncConfigStore().mergedConfig.interfaceLanguage }, set: function (val) { - this.$store.dispatch('setOption', { - name: 'interfaceLanguage', + useSyncConfigStore().setPreference({ + path: 'simple.interfaceLanguage', value: val, }) }, @@ -172,8 +172,8 @@ const ComposingTab = { }) }, updateFont(key, value) { - this.$store.dispatch('setOption', { - name: 'theme3hacks', + useSyncConfigStore().setPreference({ + path: 'simple.theme3hacks', value: { ...this.mergedConfig.theme3hacks, fonts: { diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index a0544dd30..a7e8cd4d6 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -112,8 +112,8 @@ const FilteringTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - this.$store.dispatch('setOption', { - name: 'onMuteDefaultAction', + useSyncConfigStore().setPreference({ + path: 'simple.onMuteDefaultAction', value: realValue, }) }, @@ -132,8 +132,8 @@ const FilteringTab = { if (value !== 'ask' && value !== 'forever') { realValue = '14d' } - this.$store.dispatch('setOption', { - name: 'onBlockDefaultAction', + useSyncConfigStore().setPreference({ + path: 'simple.onBlockDefaultAction', value: realValue, }) }, diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index ea939193e..eefd463db 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -10,8 +10,8 @@ import SharedComputedObject from '../helpers/shared_computed_object.js' import UnitSetting from '../helpers/unit_setting.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useSyncConfigStore } from 'src/stores/sync_config.js' +import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import localeService from 'src/services/locale/locale.service.js' @@ -41,8 +41,8 @@ const GeneralTab = { return useSyncConfigStore().mergedConfig.interfaceLanguage }, set: function (val) { - this.$store.dispatch('setOption', { - name: 'interfaceLanguage', + useSyncConfigStore().setPreference({ + path: 'simple.interfaceLanguage', value: val, }) }, @@ -69,8 +69,8 @@ const GeneralTab = { }) }, updateFont(key, value) { - this.$store.dispatch('setOption', { - name: 'theme3hacks', + useSyncConfigStore().setPreference({ + path: 'simple.theme3hacks', value: { ...this.mergedConfig.theme3hacks, fonts: { diff --git a/src/components/settings_modal/tabs/posts_tab.js b/src/components/settings_modal/tabs/posts_tab.js index 268a0a56f..6435f0d81 100644 --- a/src/components/settings_modal/tabs/posts_tab.js +++ b/src/components/settings_modal/tabs/posts_tab.js @@ -67,8 +67,8 @@ const GeneralTab = { }, methods: { updateFont(key, value) { - this.$store.dispatch('setOption', { - name: 'theme3hacks', + useSyncConfigStore().setPreference({ + path: 'simple.theme3hacks', value: { ...this.mergedConfig.theme3hacks, fonts: { diff --git a/src/lib/language.js b/src/lib/language.js index 68e3a0989..beabfcca8 100644 --- a/src/lib/language.js +++ b/src/lib/language.js @@ -15,8 +15,7 @@ export const piniaLanguagePlugin = ({ store, options }) => { if (name === 'setPreference') { const { path, value } = args[0] if (path === 'simple.interfaceLanguage') { - useI18nStore().setLanguage(value) - messages.setLanguage(this.i18n, value) + messages.setLanguage(useI18nStore().i18n, value) useEmojiStore().loadUnicodeEmojiData(value) Cookies.set( BACKEND_LANGUAGE_COOKIE_NAME, diff --git a/src/stores/interface.js b/src/stores/interface.js index dfe788262..3605f3595 100644 --- a/src/stores/interface.js +++ b/src/stores/interface.js @@ -512,8 +512,8 @@ export const useInterfaceStore = defineStore('interface', { ) if (this.useStylePalette) { - window.vuex.commit('setOption', { - name: 'palette', + useSyncConfigStore().setPreference({ + path: 'simple.palette', value: firstStylePaletteName, }) }