This commit is contained in:
Henry Jameson 2026-04-05 13:23:53 +03:00
commit 1b59cb3bdf
3 changed files with 84 additions and 25 deletions

View file

@ -17,6 +17,7 @@ import {
LOCAL_ONLY_KEYS,
ROOT_CONFIG,
ROOT_CONFIG_DEFINITIONS,
validateSetting,
} from 'src/modules/default_config_state.js'
import {
newExporter,
@ -164,7 +165,7 @@ const SettingsModal = {
})
})
} else {
const definition = ROOT_CONFIG_DEFINITIONS[entry]
const definition = ROOT_CONFIG_DEFINITIONS[path]
const finalValue = validateSetting({
path: `simple.${path}`,

View file

@ -5,18 +5,10 @@ import { useLocalConfigStore } from 'src/stores/local_config.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
import {
INSTANCE_DEFAULT_CONFIG,
LOCAL_DEFAULT_CONFIG,
LOCAL_ONLY_KEYS,
THEME_CONFIG,
ROOT_CONFIG,
} from 'src/modules/default_config_state.js'
const ROOT_CONFIG = {
...INSTANCE_DEFAULT_CONFIG,
...LOCAL_DEFAULT_CONFIG,
...THEME_CONFIG,
}
export const useMergedConfigStore = defineStore('merged_config', {
getters: {
mergedConfig: () => {

View file

@ -241,7 +241,9 @@ describe('The SyncConfig store', () => {
store.setPreference({ path: 'simple.fontInput.family', value: 'test' })
store.unsetPreference({ path: 'simple.fontInput.family' })
store.updateCache(store, { username: 'test' })
expect(store.prefsStorage.simple.fontInput).to.not.have.property('family')
expect(store.prefsStorage.simple.fontInput).to.not.have.property(
'family',
)
expect(store.prefsStorage._journal.length).to.eql(1)
})
@ -395,7 +397,12 @@ describe('The SyncConfig store', () => {
{
simple: { theme: '1', style: '0', hideISP: true },
_journal: [
{ path: 'simple.style', operation: 'set', args: ['0'], timestamp: 2 },
{
path: 'simple.style',
operation: 'set',
args: ['0'],
timestamp: 2,
},
{
path: 'simple.hideISP',
operation: 'set',
@ -408,17 +415,42 @@ describe('The SyncConfig store', () => {
{
simple: { theme: '1', style: '1', hideISP: false },
_journal: [
{ path: 'simple.theme', operation: 'set', args: ['1'], timestamp: 1 },
{ path: 'simple.style', operation: 'set', args: ['1'], timestamp: 3 },
{
path: 'simple.theme',
operation: 'set',
args: ['1'],
timestamp: 1,
},
{
path: 'simple.style',
operation: 'set',
args: ['1'],
timestamp: 3,
},
],
},
),
).to.eql({
simple: { theme: '1', style: '1', hideISP: true },
_journal: [
{ path: 'simple.theme', operation: 'set', args: ['1'], timestamp: 1 },
{ path: 'simple.style', operation: 'set', args: ['1'], timestamp: 3 },
{ path: 'simple.hideISP', operation: 'set', args: [true], timestamp: 4 },
{
path: 'simple.theme',
operation: 'set',
args: ['1'],
timestamp: 1,
},
{
path: 'simple.style',
operation: 'set',
args: ['1'],
timestamp: 3,
},
{
path: 'simple.hideISP',
operation: 'set',
args: [true],
timestamp: 4,
},
],
})
})
@ -430,7 +462,12 @@ describe('The SyncConfig store', () => {
{
simple: { theme: '1', style: '0', hideISP: false },
_journal: [
{ path: 'simple.style', operation: 'set', args: ['0'], timestamp: 2 },
{
path: 'simple.style',
operation: 'set',
args: ['0'],
timestamp: 2,
},
{
path: 'simple.hideISP',
operation: 'set',
@ -443,18 +480,42 @@ describe('The SyncConfig store', () => {
{
simple: { theme: '0', style: '0', hideISP: true },
_journal: [
{ path: 'simple.theme', operation: 'set', args: ['0'], timestamp: 1 },
{ path: 'simple.style', operation: 'set', args: ['0'], timestamp: 3 },
{
path: 'simple.theme',
operation: 'set',
args: ['0'],
timestamp: 1,
},
{
path: 'simple.style',
operation: 'set',
args: ['0'],
timestamp: 3,
},
],
},
),
).to.eql({
simple: { a: 0, b: 0, c: false },
simple: { theme: '0', style: '0', hideISP: false },
_journal: [
{ path: 'simple.theme', operation: 'set', args: ['0'], timestamp: 1 },
{ path: 'simple.style', operation: 'set', args: ['0'], timestamp: 3 },
{ path: 'simple.hideISP', operation: 'set', args: [false], timestamp: 4 },
{
path: 'simple.theme',
operation: 'set',
args: ['0'],
timestamp: 1,
},
{
path: 'simple.style',
operation: 'set',
args: ['0'],
timestamp: 3,
},
{
path: 'simple.hideISP',
operation: 'set',
args: [false],
timestamp: 4,
},
],
})
})
@ -490,7 +551,12 @@ describe('The SyncConfig store', () => {
).to.eql({
simple: { theme: 'bar' },
_journal: [
{ path: 'simple.theme', operation: 'set', args: ['bar'], timestamp: 4 },
{
path: 'simple.theme',
operation: 'set',
args: ['bar'],
timestamp: 4,
},
],
})
})