create sync records only if sync is configured. This will prevent sync conflicts after document fork.

This commit is contained in:
azivner 2017-12-13 20:34:21 -05:00
parent 2fa57b79fd
commit 17c90262c2
2 changed files with 10 additions and 7 deletions

View file

@ -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" };

View file

@ -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) {
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 = {