mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
create sync records only if sync is configured. This will prevent sync conflicts after document fork.
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user