mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
sync fix, #4288
This commit is contained in:
@@ -148,12 +148,13 @@ function fillEntityChanges(entityName, entityPrimaryKey, condition = '') {
|
||||
const entity = becca.getEntity(entityName, entityId);
|
||||
|
||||
if (entity) {
|
||||
ec.hash = entity.generateHash() || "|deleted";
|
||||
ec.hash = entity.generateHash();
|
||||
ec.utcDateChanged = entity.getUtcDateChanged() || dateUtils.utcNowDateTime();
|
||||
ec.isSynced = entityName !== 'options' || !!entity.isSynced;
|
||||
} else {
|
||||
// entity might be null (not present in becca) when it's deleted
|
||||
// FIXME: hacky, not sure if it might cause some problems
|
||||
// this will produce different hash value than when entity is being deleted since then
|
||||
// all normal hashed attributes are being used. Sync should recover from that, though.
|
||||
ec.hash = "deleted";
|
||||
ec.utcDateChanged = dateUtils.utcNowDateTime();
|
||||
ec.isSynced = true; // deletable (the ones with isDeleted) entities are synced
|
||||
|
||||
@@ -456,7 +456,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
|
||||
position: attachmentMeta.position
|
||||
});
|
||||
|
||||
attachment.setContent(content);
|
||||
attachment.setContent(content, { forceSave: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ function updateNormalEntity(remoteEC, remoteEntityRow, instanceId, updateContext
|
||||
updateContext.updated[remoteEC.entityName] = updateContext.updated[remoteEC.entityName] || [];
|
||||
updateContext.updated[remoteEC.entityName].push(remoteEC.entityId);
|
||||
|
||||
if (!localEC || localEC.utcDateChanged < remoteEC.utcDateChanged) {
|
||||
if (!localEC || localEC.utcDateChanged < remoteEC.utcDateChanged || localEC.hash !== remoteEC.hash) {
|
||||
entityChangesService.putEntityChangeWithInstanceId(remoteEC, instanceId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user