Moved welcomeFileHashes to localSettings

This commit is contained in:
benweet 2017-11-04 17:26:55 +00:00
parent abd0890512
commit 801c344c6c
4 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,5 @@
export default () => ({ export default () => ({
welcomeFileHashes: {},
showNavigationBar: true, showNavigationBar: true,
showEditor: true, showEditor: true,
showSidePreview: true, showSidePreview: true,

View File

@ -327,10 +327,13 @@ localDbSvc.sync()
// Save welcome file content hash if not done already // Save welcome file content hash if not done already
const hash = utils.hash(welcomeFile); const hash = utils.hash(welcomeFile);
const welcomeFileHashes = store.getters['data/welcomeFileHashes']; const welcomeFileHashes = store.getters['data/localSettings'].welcomeFileHashes;
if (!welcomeFileHashes[hash]) { if (!welcomeFileHashes[hash]) {
store.dispatch('data/patchWelcomeFileHashes', { store.dispatch('data/patchLocalSettings', {
welcomeFileHashes: {
...welcomeFileHashes,
[hash]: 1, [hash]: 1,
},
}); });
} }

View File

@ -157,7 +157,7 @@ function syncFile(fileId, syncContext = new SyncContext()) {
const isWelcomeFile = () => { const isWelcomeFile = () => {
const file = getFile(); const file = getFile();
const content = getContent(); const content = getContent();
const welcomeFileHashes = store.getters['data/welcomeFileHashes']; const welcomeFileHashes = store.getters['data/localSettings'].welcomeFileHashes;
const hash = content ? utils.hash(content.text) : 0; const hash = content ? utils.hash(content.text) : 0;
return file.name === 'Welcome file' && welcomeFileHashes[hash]; return file.name === 'Welcome file' && welcomeFileHashes[hash];
}; };

View File

@ -211,10 +211,6 @@ module.actions.setSyncData = setter('syncData');
module.getters.dataSyncData = getter('dataSyncData'); module.getters.dataSyncData = getter('dataSyncData');
module.actions.patchDataSyncData = patcher('dataSyncData'); module.actions.patchDataSyncData = patcher('dataSyncData');
// Welcome file content hashes (used as a file sync blacklist)
module.getters.welcomeFileHashes = getter('welcomeFileHashes');
module.actions.patchWelcomeFileHashes = patcher('welcomeFileHashes');
// Tokens // Tokens
module.getters.tokens = getter('tokens'); module.getters.tokens = getter('tokens');
module.getters.googleTokens = (state, getters) => getters.tokens.google || {}; module.getters.googleTokens = (state, getters) => getters.tokens.google || {};