diff --git a/src/components/font_control/font_control.js b/src/components/font_control/font_control.js index d1f3390cc..d7c5aa225 100644 --- a/src/components/font_control/font_control.js +++ b/src/components/font_control/font_control.js @@ -21,14 +21,7 @@ export default { Popover, LocalSettingIndicator, }, - props: [ - 'name', - 'label', - 'modelValue', - 'fallback', - 'options', - 'no-inherit', - ], + props: ['name', 'label', 'modelValue', 'fallback', 'options', 'no-inherit'], mounted() { useInterfaceStore().queryLocalFonts() }, diff --git a/src/modules/default_config_state.js b/src/modules/default_config_state.js index bc2465e70..a391e9b21 100644 --- a/src/modules/default_config_state.js +++ b/src/modules/default_config_state.js @@ -191,9 +191,12 @@ export const makeUndefined = (c) => export const defaultState = { // Set these to undefined so it does not interfere with default settings check ...makeUndefined(instanceDefaultConfig), + ...makeUndefined(defaultConfigLocal), + // If there are any configurations that does not make sense to + // have instance-wide default, put it here and explain why. - // Special processing - // Theme stuff + // # Special processing + // ## Theme stuff theme: undefined, // Very old theme store, stores preset name, still in use // V1 @@ -220,15 +223,4 @@ export const defaultState = { monospace: undefined, }, }, - - // Special handling: These fields are not of a primitive type, and - // might cause problems with current code because it specifically checks - // them in state.config (not getters.mergedConfig). - - // Specifically, muteWords is now deprecated in favour of a server-side configuration. - muteWords: [], - highlight: {}, - - // If there are any configurations that does not make sense to - // have instance-wide default, put it here and explain why. } diff --git a/src/modules/old_default_config_state.js b/src/modules/old_default_config_state.js index 6e0e730de..dc15e1c24 100644 --- a/src/modules/old_default_config_state.js +++ b/src/modules/old_default_config_state.js @@ -182,6 +182,4 @@ export const defaultConfigLocal = { mentionLinkDisplay: 'short', imageCompression: true, alwaysUseJpeg: false, - imageCompression: true, - alwaysUseJpeg: false, } diff --git a/src/stores/local_config.js b/src/stores/local_config.js index 117be393d..73ea1d7d4 100644 --- a/src/stores/local_config.js +++ b/src/stores/local_config.js @@ -32,7 +32,7 @@ export const useLocalConfigStore = defineStore('local_config', { unset({ path, value }) { set(this.prefsStorage, path, undefined) }, - clearSyncConfig() { + clearLocalConfig() { const blankState = { ...cloneDeep(defaultState) } Object.keys(this).forEach((k) => { this.prefsStorage[k] = blankState[k] diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index 51327c389..b740e1bec 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -21,7 +21,11 @@ import { useInstanceStore } from 'src/stores/instance.js' import { useLocalConfigStore } from 'src/stores/local_config.js' import { storage } from 'src/lib/storage.js' -import { defaultState as configDefaultState, makeUndefined, defaultConfigLocal } from 'src/modules/default_config_state.js' +import { + defaultState as configDefaultState, + defaultConfigLocal, + instanceDefaultConfig, +} from 'src/modules/default_config_state.js' import { defaultConfigSync } from 'src/modules/old_default_config_state.js' export const VERSION = 2 @@ -50,7 +54,8 @@ export const defaultState = { dontShowUpdateNotifs: false, collapseNav: false, muteFilters: {}, - ...makeUndefined(configDefaultState), + + ...configDefaultState, }, collections: { pinnedStatusActions: ['reply', 'retweet', 'favorite', 'emoji'], @@ -616,7 +621,7 @@ export const useSyncConfigStore = defineStore('sync_config', { let dirty = false console.debug('Migrating from old config') - const vuexState = await storage.getItem('vuex-lz') ?? {} + const vuexState = (await storage.getItem('vuex-lz')) ?? {} vuexState.config = vuexState.config ?? {} const migratedEntries = new Set(vuexState.config._syncMigration ?? []) @@ -631,7 +636,7 @@ export const useSyncConfigStore = defineStore('sync_config', { const different = !isEqual(oldValue, defaultValue) if (present && !migrated && different) { - console.debug(`Migrating config ${key}: ${oldValue}`,) + console.debug(`Migrating config ${key}: ${oldValue}`) this.setPreference({ path: `simple.${key}`, oldValue }) migratedEntries.add(key) needUpload = true @@ -721,8 +726,15 @@ export const useSyncConfigStore = defineStore('sync_config', { Object.entries(state.prefsStorage.simple).map(([k, value]) => [ k, LOCAL_ONLY_KEYS.has(k) - ? tempPrefs[k] ?? localPrefs[k] ?? instancePrefs[k] - : tempPrefs[k] ?? localPrefs[k] ?? value ?? instancePrefs[k], + ? (tempPrefs[k] ?? + localPrefs[k] ?? + instancePrefs[k] ?? + defaultConfigLocal[k]) + : (tempPrefs[k] ?? + localPrefs[k] ?? + value ?? + instancePrefs[k] ?? + instanceDefaultConfig[k]), ]), ) return result diff --git a/src/stores/user_highlight.js b/src/stores/user_highlight.js index 6a3badd01..ae2bd4d4c 100644 --- a/src/stores/user_highlight.js +++ b/src/stores/user_highlight.js @@ -278,7 +278,7 @@ export const useUserHighlightStore = defineStore('user_highlight', { const userNew = userData.created_at > NEW_USER_DATE let dirty = false - const vuexState = await storage.getItem('vuex-lz') ?? {} + const vuexState = (await storage.getItem('vuex-lz')) ?? {} vuexState.config = vuexState.config ?? {} const highlight = vuexState.config.highlight ?? {}