Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
sync fixes
zadam355780c595b4
diff --git a/src/routes/api/sync.js b/src/routes/api/sync.jsindex 354c3d6913..b5d6590eae 100644--- a/src/routes/api/sync.js+++ b/src/routes/api/sync.js@@ -139,11 +139,10 @@ function getChanged(req) {}function update(req) {- const sourceId = req.body.sourceId;- const entities = req.body.entities;+ const {sourceId, entities} = req.body;- for (const {sync, entity} of entities) {- syncUpdateService.updateEntity(sync, entity, sourceId);+ for (const {entityChange, entity} of entities) {+ syncUpdateService.updateEntity(entityChange, entity, sourceId);}}diff --git a/src/services/sync_update.js b/src/services/sync_update.jsindex 65b26f083b..79ff2bc6ae 100644--- a/src/services/sync_update.js+++ b/src/services/sync_update.js@@ -3,13 +3,13 @@ const log = require('./log');const entityChangesService = require('./entity_changes.js');const eventService = require('./events');-function updateEntity(sync, entity, sourceId) {+function updateEntity(entityChange, entity, sourceId) {// can be undefined for options with isSynced=falseif (!entity) {return false;}- const {entityName} = sync;+ const {entityName} = entityChange;let updated;if (entityName === 'notes') {@@ -28,7 +28,7 @@ function updateEntity(sync, entity, sourceId) {updated = updateNoteRevisionContent(entity, sourceId);}else if (entityName === 'note_reordering') {- updated = updateNoteReordering(sync.entityId, entity, sourceId);+ updated = updateNoteReordering(entityChange.entityId, entity, sourceId);}else if (entityName === 'options') {updated = updateOptions(entity, sourceId);