diff --git a/src/services/options.js b/src/services/options.js index 7841e3955..4214795d7 100644 --- a/src/services/options.js +++ b/src/services/options.js @@ -1,7 +1,6 @@ const repository = require('./repository'); const utils = require('./utils'); const dateUtils = require('./date_utils'); -const syncTableService = require('./sync_table'); const appInfo = require('./app_info'); const Option = require('../entities/option'); @@ -22,10 +21,6 @@ async function setOption(name, value) { throw new Error(`Option ${name} doesn't exist`); } - if (option.isSynced) { - await syncTableService.addOptionsSync(name); - } - option.value = value; await option.save(); @@ -37,10 +32,6 @@ async function createOption(name, value, isSynced) { value: value, isSynced: isSynced }).save(); - - if (isSynced) { - await syncTableService.addOptionsSync(name); - } } async function initOptions(startNotePath) { diff --git a/src/services/repository.js b/src/services/repository.js index e0287ad87..ff9f299ce 100644 --- a/src/services/repository.js +++ b/src/services/repository.js @@ -59,7 +59,9 @@ async function updateEntity(entity) { const primaryKey = entity[entity.constructor.primaryKeyName]; - await syncTableService.addEntitySync(entity.constructor.tableName, primaryKey); + if (entity.constructor.tableName !== 'options' || entity.isSynced) { + await syncTableService.addEntitySync(entity.constructor.tableName, primaryKey); + } }); }