From 17c90262c27b2da08784971f75c5792e24632852 Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 13 Dec 2017 20:34:21 -0500 Subject: [PATCH] create sync records only if sync is configured. This will prevent sync conflicts after document fork. --- services/build.js | 2 +- services/sync_table.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/services/build.js b/services/build.js index e5ca41958..23a9cd9e6 100644 --- a/services/build.js +++ b/services/build.js @@ -1 +1 @@ -module.exports = { build_date:"2017-12-10T23:23:04-05:00", build_revision: "bdeaa2829d4c5436e86d0d943a2a332d0c016804" }; +module.exports = { build_date:"2017-12-12T23:57:58-05:00", build_revision: "2fa57b79fd972b3eda6eb8ef1d26e9915b75fd96" }; diff --git a/services/sync_table.js b/services/sync_table.js index 65348cf1f..22b758d64 100644 --- a/services/sync_table.js +++ b/services/sync_table.js @@ -1,6 +1,7 @@ const sql = require('./sql'); const source_id = require('./source_id'); const utils = require('./utils'); +const sync = require('./sync'); async function addNoteSync(noteId, sourceId) { await addEntitySync("notes", noteId, sourceId) @@ -27,12 +28,14 @@ async function addRecentNoteSync(notePath, sourceId) { } async function addEntitySync(entityName, entityId, sourceId) { - await sql.replace("sync", { - entity_name: entityName, - entity_id: entityId, - sync_date: utils.nowDate(), - source_id: sourceId || source_id.currentSourceId - }); + if (sync.isSyncSetup) { + await sql.replace("sync", { + entity_name: entityName, + entity_id: entityId, + sync_date: utils.nowDate(), + source_id: sourceId || source_id.currentSourceId + }); + } } module.exports = {