Compare commits

..

4 commits

Author SHA1 Message Date
Henry Jameson
6d6c627c3e improved visibility notice styles while i'm at it 2026-02-16 17:05:19 +02:00
Henry Jameson
20162e5358 fix notifications 2026-02-16 16:58:17 +02:00
Henry Jameson
2e53707324 pass 2 2026-02-16 16:58:11 +02:00
Henry Jameson
6124d9c04c setOption pass 1 2026-02-16 02:24:44 +02:00
24 changed files with 131 additions and 113 deletions

View file

@ -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().setSimplePrefAndSave({ path: 'interfaceLanguage', value: val })
document.getElementById('modal').classList = ['-' + this.layoutType]
// Create bound handlers

View file

@ -797,14 +797,17 @@ option {
}
.notice-dismissible {
padding-right: 4rem;
position: relative;
display: flex;
padding: 0.75em 1em;
align-items: baseline;
line-height: 1.5;
span {
display: block;
flex: 1 1 auto;
}
.dismiss {
position: absolute;
top: 0;
right: 0;
padding: 0.5em;
color: inherit;
}
}

View file

@ -61,8 +61,8 @@ const ExtraNotifications = {
return useInterfaceStore().openSettingsModalTab('notifications')
},
dismissConfigurationTip() {
return this.$store.dispatch('setOption', {
name: 'showExtraNotificationsTip',
return useSyncConfigStore().setSimplePrefAndSave({
path: 'showExtraNotificationsTip',
value: false,
})
},

View file

@ -84,8 +84,8 @@ const NavPanel = {
this.editMode = !this.editMode
},
toggleCollapse() {
useSyncConfigStore().setPreference({
path: 'simple.collapseNav',
useSyncConfigStore().setSimplePrefAndSave({
path: 'collapseNav',
value: !this.collapsed,
})
useSyncConfigStore().pushSyncConfig()

View file

@ -124,8 +124,8 @@ export default {
},
methods: {
toggleNotificationFilter(type) {
this.$store.dispatch('setOption', {
name: 'notificationVisibility',
useSyncConfigStore().setSimplePrefAndSave({
path: 'notificationVisibility',
value: {
...this.filters,
[type]: !this.filters[type],

View file

@ -819,8 +819,8 @@ const PostStatusForm = {
}
},
dismissScopeNotice() {
this.$store.dispatch('setOption', {
name: 'hideScopeNotice',
useSyncConfigStore().setSimplePrefAndSave({
path: 'hideScopeNotice',
value: true,
})
},

View file

@ -111,7 +111,6 @@
.visibility-notice {
border: 1px solid var(--border);
border-radius: var(--roundness);
padding: 0.5em 1em
}
.visibility-notice.edit-warning {

View file

@ -20,8 +20,8 @@ const QuickFilterSettings = {
},
methods: {
setReplyVisibility(visibility) {
this.$store.dispatch('setOption', {
name: 'replyVisibility',
useSyncConfigStore().setSimplePrefAndSave({
path: '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().setSimplePrefAndSave({ path: 'hideAttachments', value })
useSyncConfigStore().setSimplePrefAndSave({
path: 'hideAttachmentsInConv',
value,
})
},
@ -100,8 +100,8 @@ const QuickFilterSettings = {
},
set() {
const value = !this.hideMutedPosts
this.$store.dispatch('setOption', {
name: 'hideFilteredStatuses',
useSyncConfigStore().setSimplePrefAndSave({
path: 'hideFilteredStatuses',
value,
})
},
@ -112,7 +112,7 @@ const QuickFilterSettings = {
},
set() {
const value = !this.muteBotStatuses
this.$store.dispatch('setOption', { name: 'muteBotStatuses', value })
useSyncConfigStore().setSimplePrefAndSave({ path: 'muteBotStatuses', value })
},
},
muteSensitiveStatuses: {
@ -121,8 +121,8 @@ const QuickFilterSettings = {
},
set() {
const value = !this.muteSensitiveStatuses
this.$store.dispatch('setOption', {
name: 'muteSensitiveStatuses',
useSyncConfigStore().setSimplePrefAndSave({
path: 'muteSensitiveStatuses',
value,
})
},

View file

@ -42,8 +42,8 @@ const QuickViewSettings = {
return this.mergedConfig.conversationDisplay
},
set(value) {
useSyncConfigStore().setPreference({
path: 'simple.conversationDisplay',
useSyncConfigStore().setSimplePrefAndSave({
path: 'conversationDisplay',
value,
})
},
@ -54,7 +54,7 @@ const QuickViewSettings = {
},
set() {
const value = !this.autoUpdate
useSyncConfigStore().setPreference({ path: 'simple.streaming', value })
useSyncConfigStore().setSimplePrefAndSave({ path: 'streaming', value })
},
},
collapseWithSubjects: {
@ -63,8 +63,8 @@ const QuickViewSettings = {
},
set() {
const value = !this.collapseWithSubjects
useSyncConfigStore().setPreference({
path: 'simple.collapseMessageWithSubject',
useSyncConfigStore().setSimplePrefAndSave({
path: 'collapseMessageWithSubject',
value,
})
},
@ -75,8 +75,8 @@ const QuickViewSettings = {
},
set() {
const value = !this.showUserAvatars
useSyncConfigStore().setPreference({
path: 'simple.mentionLinkShowAvatar',
useSyncConfigStore().setSimplePrefAndSave({
path: 'mentionLinkShowAvatar',
value,
})
},
@ -87,8 +87,8 @@ const QuickViewSettings = {
},
set() {
const value = !this.muteBotStatuses
useSyncConfigStore().setPreference({
path: 'simple.muteBotStatuses',
useSyncConfigStore().setSimplePrefAndSave({
path: 'muteBotStatuses',
value,
})
},
@ -99,8 +99,8 @@ const QuickViewSettings = {
},
set() {
const value = !this.muteSensitiveStatuses
useSyncConfigStore().setPreference({
path: 'simple.muteSensitiveStatuses',
useSyncConfigStore().setSimplePrefAndSave({
path: 'muteSensitiveStatuses',
value,
})
},

View file

@ -259,7 +259,7 @@ export default {
const writePath = `simple.${readPath}`
if (!this.timedApplyMode) {
useSyncConfigStore().setPreference({ path: writePath, value })
useSyncConfigStore().setSimplePrefAndSave({ path: writePath, value })
useSyncConfigStore().pushSyncConfig()
} else {
if (useInterfaceStore().temporaryChangesTimeoutId !== null) {

View file

@ -195,8 +195,8 @@ const SettingsModal = {
return useSyncConfigStore().mergedConfig.expertLevel > 0
},
set(value) {
useSyncConfigStore().setPreference({
path: 'simple.expertLevel',
useSyncConfigStore().setSimplePrefAndSave({
path: 'expertLevel',
value: value ? 1 : 0,
})
},

View file

@ -52,8 +52,8 @@ const ClutterTab = {
if (value !== 'ask' && value !== 'forever') {
realValue = '14d'
}
this.$store.dispatch('setOption', {
name: 'onMuteDefaultAction',
useSyncConfigStore().setSimplePrefAndSave({
path: 'onMuteDefaultAction',
value: realValue,
})
},
@ -72,8 +72,8 @@ const ClutterTab = {
if (value !== 'ask' && value !== 'forever') {
realValue = '14d'
}
this.$store.dispatch('setOption', {
name: 'onBlockDefaultAction',
useSyncConfigStore().setSimplePrefAndSave({
path: 'onBlockDefaultAction',
value: realValue,
})
},
@ -90,8 +90,8 @@ const ClutterTab = {
},
methods: {
...mapActions(useSyncConfigStore, [
'setPreference',
'unsetPreference',
'setSimplePrefAndSave',
'unsetSimplePrefAndSave',
'pushSyncConfig',
]),
getDatetimeLocal(timestamp) {
@ -138,7 +138,7 @@ const ClutterTab = {
filter.order = this.muteFilters.length + 2
this.muteFiltersDraftObject[newId] = filter
this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter })
this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter })
this.pushSyncConfig()
},
exportFilter(id) {
@ -154,18 +154,18 @@ const ClutterTab = {
const newId = uuidv4()
this.muteFiltersDraftObject[newId] = filter
this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter })
this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter })
this.pushSyncConfig()
},
deleteFilter(id) {
delete this.muteFiltersDraftObject[id]
this.unsetPreference({ path: 'simple.muteFilters.' + id, value: null })
this.unsetSimplePrefAndSave({ path: 'muteFilters.' + id, value: null })
this.pushSyncConfig()
},
purgeExpiredFilters() {
this.muteFiltersExpired.forEach(([id]) => {
delete this.muteFiltersDraftObject[id]
this.unsetPreference({ path: 'simple.muteFilters.' + id, value: null })
this.unsetSimplePrefAndSave({ path: 'muteFilters.' + id, value: null })
})
this.pushSyncConfig()
},
@ -189,8 +189,8 @@ const ClutterTab = {
this.muteFiltersDraftDirty[id] = true
},
saveFilter(id) {
this.setPreference({
path: 'simple.muteFilters.' + id,
this.setSimplePrefAndSave({
path: 'muteFilters.' + id,
value: this.muteFiltersDraftObject[id],
})
this.pushSyncConfig()

View file

@ -120,8 +120,8 @@ const ComposingTab = {
return useSyncConfigStore().mergedConfig.interfaceLanguage
},
set: function (val) {
this.$store.dispatch('setOption', {
name: 'interfaceLanguage',
useSyncConfigStore().setSimplePrefAndSave({
path: 'interfaceLanguage',
value: val,
})
},
@ -172,8 +172,8 @@ const ComposingTab = {
})
},
updateFont(key, value) {
this.$store.dispatch('setOption', {
name: 'theme3hacks',
useSyncConfigStore().setSimplePrefAndSave({
path: 'theme3hacks',
value: {
...this.mergedConfig.theme3hacks,
fonts: {

View file

@ -36,11 +36,11 @@ const FilteringTab = {
label: this.$t(`user_card.mute_block_${mode}`),
})),
muteFiltersDraftObject: cloneDeep(
useSyncConfigStore().prefsStorage.simple.muteFilters,
this.prefsStorage.simple.muteFilters,
),
muteFiltersDraftDirty: Object.fromEntries(
Object.entries(
useSyncConfigStore().prefsStorage.simple.muteFilters,
this.prefsStorage.simple.muteFilters,
).map(([k]) => [k, false]),
),
exportedFilter: null,
@ -112,8 +112,8 @@ const FilteringTab = {
if (value !== 'ask' && value !== 'forever') {
realValue = '14d'
}
this.$store.dispatch('setOption', {
name: 'onMuteDefaultAction',
this.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',
this.setPreference({
path: 'simple.onBlockDefaultAction',
value: realValue,
})
},
@ -151,7 +151,9 @@ const FilteringTab = {
methods: {
...mapActions(useSyncConfigStore, [
'setPreference',
'setPrefAndSave',
'unsetPreference',
'unsetPrefAndSave',
'pushSyncConfig',
]),
getDatetimeLocal(timestamp) {
@ -198,8 +200,7 @@ const FilteringTab = {
filter.order = this.muteFilters.length + 2
this.muteFiltersDraftObject[newId] = filter
this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter })
this.pushSyncConfig()
this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter })
},
exportFilter(id) {
this.exportedFilter = { ...this.muteFiltersDraftObject[id] }
@ -214,13 +215,11 @@ const FilteringTab = {
const newId = uuidv4()
this.muteFiltersDraftObject[newId] = filter
this.setPreference({ path: 'simple.muteFilters.' + newId, value: filter })
this.pushSyncConfig()
this.setSimplePrefAndSave({ path: 'muteFilters.' + newId, value: filter })
},
deleteFilter(id) {
delete this.muteFiltersDraftObject[id]
this.unsetPreference({ path: 'simple.muteFilters.' + id, value: null })
this.pushSyncConfig()
this.unsetSimplePrefAndSave({ path: 'muteFilters.' + id, value: null })
},
purgeExpiredFilters() {
this.muteFiltersExpired.forEach(([id]) => {
@ -249,11 +248,10 @@ const FilteringTab = {
this.muteFiltersDraftDirty[id] = true
},
saveFilter(id) {
this.setPreference({
path: 'simple.muteFilters.' + id,
this.setPrefAndSave({
path: 'muteFilters.' + id,
value: this.muteFiltersDraftObject[id],
})
this.pushSyncConfig()
this.muteFiltersDraftDirty[id] = false
},
},

View file

@ -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().setSimplePrefAndSave({
path: 'interfaceLanguage',
value: val,
})
},
@ -69,8 +69,8 @@ const GeneralTab = {
})
},
updateFont(key, value) {
this.$store.dispatch('setOption', {
name: 'theme3hacks',
useSyncConfigStore().setSimplePrefAndSave({
path: 'theme3hacks',
value: {
...this.mergedConfig.theme3hacks,
fonts: {

View file

@ -67,8 +67,8 @@ const GeneralTab = {
},
methods: {
updateFont(key, value) {
this.$store.dispatch('setOption', {
name: 'theme3hacks',
useSyncConfigStore().setSimplePrefAndSave({
path: 'theme3hacks',
value: {
...this.mergedConfig.theme3hacks,
fonts: {

View file

@ -57,8 +57,8 @@ const UpdateNotification = {
flag: 'updateCounter',
value: CURRENT_UPDATE_COUNTER,
})
useSyncConfigStore().setPreference({
path: 'simple.dontShowUpdateNotifs',
useSyncConfigStore().setSimplePrefAndSave({
path: 'dontShowUpdateNotifs',
value: true,
})
useSyncConfigStore().pushSyncConfig()

View file

@ -84,16 +84,16 @@ const UserTimedFilterModal = {
if (this.isMute) {
this.$store.dispatch('muteUser', this.requestBody)
if (this.dontAskAgain) {
this.$store.dispatch('setOption', {
name: 'onMuteDefaultAction',
useSyncConfigStore().setSimplePrefAndSave({
path: 'onMuteDefaultAction',
value: this.expiryString,
})
}
} else {
this.$store.dispatch('blockUser', this.requestBody)
if (this.dontAskAgain) {
this.$store.dispatch('setOption', {
name: 'onBlockDefaultAction',
useSyncConfigStore().setSimplePrefAndSave({
path: 'onBlockDefaultAction',
value: this.expiryString,
})
}

View file

@ -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,

View file

@ -10,7 +10,7 @@ const simpleDeclaration = {
store: 'server-side',
migrationFlag: 'configMigration',
migration(serverside, rootState) {
serverside.setPreference({ path: 'simple.' + field, value: rootState.config[oldField ?? field] })
serverside.setSimplePrefAndSave({ path: field, value: rootState.config[oldField ?? field] })
}
}
*/

View file

@ -118,6 +118,7 @@ export const notifications = {
commit('addNewNotifications', { notifications: [notification] })
maybeShowNotification(
useSyncConfigStore().mergedConfig.notificationVisibility,
store,
Object.values(useSyncConfigStore().prefsStorage.simple.muteFilters),
notification,

View file

@ -725,7 +725,7 @@ const users = {
Object.keys(
useSyncConfigStore().prefsStorage.simple.muteFilters
).forEach(key => {
useSyncConfigStore().unsetPreference({ path: 'simple.muteFilters.' + key, value: null })
useSyncConfigStore().unsetSimplePrefAndSave({ path: 'muteFilters.' + key, value: null })
})
// Reset flag to 0 to re-run migrations

View file

@ -226,14 +226,14 @@ export const useInterfaceStore = defineStore('interface', {
try {
const value = await getResourcesIndex('/static/palettes/index.json')
useInstanceStore().set({
name: 'palettesIndex',
path: 'palettesIndex',
value,
})
return value
} catch (e) {
console.error('Could not fetch palettes index', e)
useInstanceStore().set({
name: 'palettesIndex',
path: 'palettesIndex',
value: { _error: e },
})
return Promise.resolve({})
@ -243,7 +243,8 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
window.vuex.commit('setOption', { name: 'palette', value })
useSyncConfigStore().setPreference({ path: 'simple.palette', value })
useSyncConfigStore().pushSyncConfig()
this.applyTheme({ recompile: true })
},
@ -251,7 +252,8 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
window.vuex.commit('setOption', { name: 'paletteCustomData', value })
useSyncConfigStore().setPreference({ path: 'simple.paletteCustomData', value })
useSyncConfigStore().pushSyncConfig()
this.applyTheme({ recompile: true })
},
@ -261,12 +263,12 @@ export const useInterfaceStore = defineStore('interface', {
'/static/styles/index.json',
deserialize,
)
useInstanceStore().set({ name: 'stylesIndex', value })
useInstanceStore().set({ path: 'stylesIndex', value })
return value
} catch (e) {
console.error('Could not fetch styles index', e)
useInstanceStore().set({
name: 'stylesIndex',
path: 'simple.stylesIndex',
value: { _error: e },
})
return Promise.resolve({})
@ -277,7 +279,8 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV2()
this.resetThemeV3Palette()
window.vuex.commit('setOption', { name: 'style', value })
useSyncConfigStore().setPreference({ path: 'simple.style', value })
useSyncConfigStore().pushSyncConfig()
this.useStylePalette = true
this.applyTheme({ recompile: true }).then(() => {
@ -289,7 +292,8 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV2()
this.resetThemeV3Palette()
window.vuex.commit('setOption', { name: 'styleCustomData', value })
useSyncConfigStore().setPreference({ path: 'simple.styleCustomData', value })
useSyncConfigStore().pushSyncConfig()
this.useStylePalette = true
this.applyTheme({ recompile: true }).then(() => {
@ -299,12 +303,12 @@ export const useInterfaceStore = defineStore('interface', {
async fetchThemesIndex() {
try {
const value = await getResourcesIndex('/static/styles.json')
useInstanceStore().set({ name: 'themesIndex', value })
useInstanceStore().set({ path: 'simple.themesIndex', value })
return value
} catch (e) {
console.error('Could not fetch themes index', e)
useInstanceStore().set({
name: 'themesIndex',
path: 'themesIndex',
value: { _error: e },
})
return Promise.resolve({})
@ -315,7 +319,8 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
window.vuex.commit('setOption', { name: 'theme', value })
useSyncConfigStore().setPreference({ path: 'simple.theme', value })
useSyncConfigStore().pushSyncConfig()
this.applyTheme({ recompile: true })
},
@ -324,29 +329,33 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
window.vuex.commit('setOption', { name: 'customTheme', value })
window.vuex.commit('setOption', { name: 'customThemeSource', value })
useSyncConfigStore().setPreference({ path: 'simple.customTheme', value })
useSyncConfigStore().setPreference({ path: 'simple.customThemeSource', value })
useSyncConfigStore().pushSyncConfig()
this.applyTheme({ recompile: true })
},
resetThemeV3() {
window.vuex.commit('setOption', { name: 'style', value: null })
window.vuex.commit('setOption', { name: 'styleCustomData', value: null })
useSyncConfigStore().setPreference({ path: 'simple.style', value: null })
useSyncConfigStore().setPreference({ path: 'simple.styleCustomData', value: null })
useSyncConfigStore().pushSyncConfig()
},
resetThemeV3Palette() {
window.vuex.commit('setOption', { name: 'palette', value: null })
window.vuex.commit('setOption', {
name: 'paletteCustomData',
useSyncConfigStore().setPreference({ path: 'simple.palette', value: null })
useSyncConfigStore().setPreference({
path: 'simple.paletteCustomData',
value: null,
})
useSyncConfigStore().pushSyncConfig()
},
resetThemeV2() {
window.vuex.commit('setOption', { name: 'theme', value: null })
window.vuex.commit('setOption', { name: 'customTheme', value: null })
window.vuex.commit('setOption', {
name: 'customThemeSource',
useSyncConfigStore().setPreference({ path: 'simple.theme', value: null })
useSyncConfigStore().setPreference({ path: 'simple.customTheme', value: null })
useSyncConfigStore().setPreference({
path: 'simple.customThemeSource',
value: null,
})
useSyncConfigStore().pushSyncConfig()
},
async getThemeData() {
const getData = async (resource, index, customData, name) => {
@ -512,10 +521,11 @@ export const useInterfaceStore = defineStore('interface', {
)
if (this.useStylePalette) {
window.vuex.commit('setOption', {
name: 'palette',
useSyncConfigStore().setPreference({
path: 'simple.palette',
value: firstStylePaletteName,
})
useSyncConfigStore().pushSyncConfig()
}
this.paletteNameUsed = palette.nameUsed

View file

@ -417,6 +417,14 @@ export const useSyncConfigStore = defineStore('sync_config', {
this.flagStorage[flag] = value
this.dirty = true
},
setSimplePrefAndSave({ path, value }) {
this.setPreference({ path: `simple.${path}`, value })
this.pushSyncConfig()
},
unsetSimplePrefAndSave({ path }) {
this.unsetPreference({ path: `simple.${path}` })
this.pushSyncConfig()
},
setPreference({ path, value }) {
if (path.startsWith('_')) {
throw new Error(
@ -472,7 +480,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
`Calling unset on depth > 3 (path: ${path}) is not allowed`,
)
}
unset(this.prefsStorage, path, value)
unset(this.prefsStorage, path)
this.prefsStorage._journal = [
...this.prefsStorage._journal,
{ operation: 'unset', path, args: [], timestamp: Date.now() },