diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index 04dfe76bd..facc6073f 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -36,11 +36,11 @@ const FilteringTab = { label: this.$t(`user_card.mute_block_${mode}`), })), muteFiltersDraftObject: cloneDeep( - this.prefsStorage.simple.muteFilters, + useSyncConfigStore().prefsStorage.simple.muteFilters, ), muteFiltersDraftDirty: Object.fromEntries( Object.entries( - this.prefsStorage.simple.muteFilters, + useSyncConfigStore().prefsStorage.simple.muteFilters, ).map(([k]) => [k, false]), ), exportedFilter: null, diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index c87e0bece..99ff0f6d5 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -159,13 +159,6 @@ export const _getRecentData = (cache, live, isTest) => { } const merge = (a, b) => { - console.log( - 'MERGE', - a.prefsStorage.simple.conversationDisplay, - b.prefsStorage.simple.conversationDisplay, - ) - console.log(a.prefsStorage.simple) - console.log(cloneDeep(a.prefsStorage).simple) return { _user: a._user ?? b._user, _version: a._version ?? b._version, @@ -176,18 +169,14 @@ export const _getRecentData = (cache, live, isTest) => { } } - console.log('1',result.recent.prefsStorage.simple.conversationDisplay) - result.recent = isTest ? result.recent : result.recent && merge(defaultState, result.recent) - console.log('2',result.recent.prefsStorage.simple.conversationDisplay) result.stale = isTest ? result.stale : result.stale && merge(defaultState, result.stale) - console.log('3', result.recent.prefsStorage.simple.conversationDisplay) return result } @@ -597,21 +586,7 @@ export const useSyncConfigStore = defineStore('sync_config', { cache = null } - console.log('======') - console.log('CACHE', cache?.prefsStorage?.simple?.conversationDisplay) - console.log('LIVE', live?.prefsStorage?.simple?.conversationDisplay) - if (cache?._timestamp > live?._timestamp) { - console.log('C > L') - } else if (cache?._timestamp === live?._timestamp) { - console.log('C = L') - } else { - console.log('C < L') - } let { recent, stale, needUpload } = _getRecentData(cache, live) - console.log('======') - console.log('RECENT', recent.prefsStorage?.simple?.conversationDisplay) - console.log('STALE', stale?.prefsStorage?.simple?.conversationDisplay) - console.log('======') const userNew = userData.created_at > NEW_USER_DATE const flagsTemplate = userNew ? newUserFlags : defaultState.flagStorage diff --git a/test/unit/specs/stores/sync_config.spec.js b/test/unit/specs/stores/sync_config.spec.js index abcddbeb1..561f6dcbb 100644 --- a/test/unit/specs/stores/sync_config.spec.js +++ b/test/unit/specs/stores/sync_config.spec.js @@ -123,30 +123,14 @@ describe('The SyncConfig module', () => { store.setPreference({ path: 'simple.testing', value: 1 }) store.setPreference({ path: 'simple.testing', value: 2 }) store.addCollectionPreference({ path: 'collections.testing', value: 2 }) - store.addCollectionPreference({ - path: 'objectCollections.testing', - value: { _key: 'a', foo: 1 }, - }) - expect(store.prefsStorage.objectCollections.testing).to.eql({ - data: { a: { _key: 'a', foo: 1 } }, - index: ['a'], - }) store.removeCollectionPreference({ path: 'collections.testing', value: 2, }) - store.removeCollectionPreference({ - path: 'objectCollections.testing', - value: { _key: 'a' }, - }) store.updateCache({ username: 'test' }) expect(store.prefsStorage.simple.testing).to.eql(2) expect(store.prefsStorage.collections.testing).to.eql([]) - expect(store.prefsStorage.objectCollections.testing).to.eql({ - data: {}, - index: [], - }) - expect(store.prefsStorage._journal.length).to.eql(3) + expect(store.prefsStorage._journal.length).to.eql(2) expect(store.prefsStorage._journal[0]).to.eql({ path: 'simple.testing', operation: 'set', @@ -161,13 +145,6 @@ describe('The SyncConfig module', () => { // should have A timestamp, we don't really care what it is timestamp: store.prefsStorage._journal[1].timestamp, }) - expect(store.prefsStorage._journal[2]).to.eql({ - path: 'objectCollections.testing', - operation: 'removeFromCollection', - args: [{ _key: 'a' }], - // should have A timestamp, we don't really care what it is - timestamp: store.prefsStorage._journal[2].timestamp, - }) }) it('should remove duplicate entries from journal', () => { @@ -176,22 +153,10 @@ describe('The SyncConfig module', () => { store.setPreference({ path: 'simple.testing', value: 1 }) store.addCollectionPreference({ path: 'collections.testing', value: 2 }) store.addCollectionPreference({ path: 'collections.testing', value: 2 }) - store.addCollectionPreference({ - path: 'objectCollections.testing', - value: { _key: 'a', foo: 1 }, - }) - store.addCollectionPreference({ - path: 'objectCollections.testing', - value: { _key: 'a', foo: 1 }, - }) store.updateCache({ username: 'test' }) expect(store.prefsStorage.simple.testing).to.eql(1) expect(store.prefsStorage.collections.testing).to.eql([2]) - expect(store.prefsStorage.objectCollections.testing).to.eql({ - data: { a: { _key: 'a', foo: 1 } }, - index: ['a'], - }) - expect(store.prefsStorage._journal.length).to.eql(4) + expect(store.prefsStorage._journal.length).to.eql(2) }) it('should remove depth = 3 set/unset entries from journal', () => {