diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue
index 677781d97..963f81ff8 100644
--- a/src/components/status_body/status_body.vue
+++ b/src/components/status_body/status_body.vue
@@ -49,6 +49,7 @@
:is-local="status.is_local"
@parse-ready="onParseReady"
/>
+ {{ mergedConfig }}
server-side migrations
- reset: 0, // special flag that can be used to force-reset all flags, debug purposes only
+ reset: 0, // special flag that can be used to force-reset all data, debug purposes only
// special reset codes:
// 1000: trim keys to those known by currently running FE
// 1001: same as above + reset everything to 0
@@ -379,16 +381,30 @@ export const _resetFlags = (
result[flag] = 0
})
}
- } else if (totalFlags.reset > 0 && totalFlags.reset < 9000) {
- console.debug('Received command to reset the flags')
- allFlagKeys.forEach((flag) => {
- result[flag] = 0
- })
}
result.reset = 0
return result
}
+export const _resetPrefs = (
+ totalFlags,
+ totalPrefs,
+ knownKeys = defaultState.flagStorage,
+) => {
+ // prefs reset functionality
+ if (
+ totalFlags.reset >= COMMAND_WIPE_JOURNAL &&
+ totalFlags.reset <= COMMAND_WIPE_JOURNAL_AND_STORAGE
+ ) {
+ console.debug('Received command to reset journals')
+ clearJournals()
+ if (totalFlags.reset === COMMAND_WIPE_JOURNAL_AND_STORAGE) {
+ console.debug('Received command to reset storage')
+ return cloneDeep(defaultState)
+ }
+ } return totalPrefs
+}
+
export const _doMigrations = (cache, live) => {
const data = cache ?? live
@@ -578,8 +594,10 @@ export const useSyncConfigStore = defineStore('sync_config', {
Object.keys(this).forEach((k) => {
this[k] = blankState[k]
})
+ this.flagStorage.reset = COMMAND_WIPE_JOURNAL_AND_STORAGE
},
clearJournals() {
+ this.flagStorage.reset = COMMAND_WIPE_JOURNAL
this.prefsStorage._journal = []
this.cache.prefsStorage._journal = []
this.raw.prefsStorage._journal = []
@@ -639,6 +657,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
totalPrefs = recent.prefsStorage
}
+ totalPrefs = _resetPrefs(totalPrefs, totalFlags)
totalFlags = _resetFlags(totalFlags)
recent.flagStorage = { ...flagsTemplate, ...totalFlags }