mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-04-20 18:30:41 -05:00
fix syncing protected notes in case there wasn't any other change, closes #1778
This commit is contained in:
@@ -156,14 +156,14 @@ class Note extends Entity {
|
||||
|
||||
sql.upsert("note_contents", "noteId", pojo);
|
||||
|
||||
const hash = utils.hash(this.noteId + "|" + content.toString());
|
||||
const hash = utils.hash(this.noteId + "|" + pojo.content.toString());
|
||||
|
||||
entityChangesService.addEntityChange({
|
||||
entityName: 'note_contents',
|
||||
entityId: this.noteId,
|
||||
hash: hash,
|
||||
isErased: false,
|
||||
utcDateChanged: this.getUtcDateChanged()
|
||||
utcDateChanged: pojo.utcDateModified
|
||||
}, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@ function updateEntity(entityChange, entity, sourceId) {
|
||||
? updateNoteReordering(entityChange, entity, sourceId)
|
||||
: updateNormalEntity(entityChange, entity, sourceId);
|
||||
|
||||
// currently making exception for protected notes and note revisions because here
|
||||
// the title and content are not available decrypted as listeners would expect
|
||||
if (updated && !entity.isProtected && !entityChange.isErased) {
|
||||
if (updated && !entityChange.isErased) {
|
||||
eventService.emit(eventService.ENTITY_SYNCED, {
|
||||
entityName: entityChange.entityName,
|
||||
entity
|
||||
@@ -44,7 +42,7 @@ function updateNormalEntity(remoteEntityChange, entity, sourceId) {
|
||||
|
||||
if (localEntityChange && !localEntityChange.isErased && remoteEntityChange.isErased) {
|
||||
sql.transactional(() => {
|
||||
const primaryKey = entityConstructor.getEntityFromEntityName(entityName).primaryKeyName;
|
||||
const primaryKey = entityConstructor.getEntityFromEntityName(remoteEntityChange.entityName).primaryKeyName;
|
||||
|
||||
sql.execute(`DELETE FROM ${remoteEntityChange.entityName} WHERE ${primaryKey} = ?`, remoteEntityChange.entityId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user