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
fix storing dateLastEdited timestamp in note revisions
zadamb0bf88c48703
diff --git a/src/entities/note.js b/src/entities/note.jsindex 2d49848e0d..6ed2c9f01c 100644--- a/src/entities/note.js+++ b/src/entities/note.js@@ -105,6 +105,7 @@ class Note extends Entity {}}+ /** @returns {{contentLength, dateModified, utcDateModified}} */getContentMetadata() {return sql.getRow(`SELECTdiff --git a/src/services/note_revisions.js b/src/services/note_revisions.jsindex 3772ec41cd..b9c70f96a3 100644--- a/src/services/note_revisions.js+++ b/src/services/note_revisions.js@@ -30,6 +30,8 @@ function createNoteRevision(note) {return;}+ const contentMetadata = note.getContentMetadata();+const noteRevision = new NoteRevision({noteId: note.noteId,// title and text should be decrypted now@@ -37,10 +39,14 @@ function createNoteRevision(note) {type: note.type,mime: note.mime,isProtected: false, // will be fixed in the protectNoteRevisions() call- utcDateLastEdited: note.utcDateModified,+ utcDateLastEdited: note.utcDateModified > contentMetadata.utcDateModified+ ? note.utcDateModified+ : contentMetadata.utcDateModified,utcDateCreated: dateUtils.utcNowDateTime(),utcDateModified: dateUtils.utcNowDateTime(),- dateLastEdited: note.dateModified,+ dateLastEdited: note.dateModified > contentMetadata.dateModified+ ? note.dateModified+ : contentMetadata.dateModified,dateCreated: dateUtils.localNowDateTime()}).save();