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 toggling protected flag and display of the title
zadam010f075ac537
diff --git a/src/becca/entities/abstract_entity.js b/src/becca/entities/abstract_entity.jsindex 7d9cc7662a..f982bf98d3 100644--- a/src/becca/entities/abstract_entity.js+++ b/src/becca/entities/abstract_entity.js@@ -57,6 +57,10 @@ class AbstractEntity {});}+ getPojoToSave() {+ return this.getPojo();+ }+save() {const entityName = this.constructor.entityName;const primaryKeyName = this.constructor.primaryKeyName;@@ -67,7 +71,7 @@ class AbstractEntity {this.beforeSaving();}- const pojo = this.getPojo();+ const pojo = this.getPojoToSave();sql.transactional(() => {sql.upsert(entityName, primaryKeyName, pojo);diff --git a/src/becca/entities/note.js b/src/becca/entities/note.jsindex 316f87f5ef..f6db3e718a 100644--- a/src/becca/entities/note.js+++ b/src/becca/entities/note.js@@ -1084,7 +1084,7 @@ class Note extends AbstractEntity {}getPojo() {- const pojo = {+ return {noteId: this.noteId,title: this.title,isProtected: this.isProtected,@@ -1096,6 +1096,10 @@ class Note extends AbstractEntity {utcDateCreated: this.utcDateCreated,utcDateModified: this.utcDateModified};+ }++ getPojoToSave() {+ const pojo = this.getPojo();if (pojo.isProtected) {if (this.isDecrypted) {diff --git a/src/becca/entities/note_revision.js b/src/becca/entities/note_revision.jsindex d2eb71378f..d90649231a 100644--- a/src/becca/entities/note_revision.js+++ b/src/becca/entities/note_revision.js@@ -156,7 +156,7 @@ class NoteRevision extends AbstractEntity {}getPojo() {- const pojo = {+ return {noteRevisionId: this.noteRevisionId,noteId: this.noteId,type: this.type,@@ -169,6 +169,10 @@ class NoteRevision extends AbstractEntity {utcDateCreated: this.utcDateCreated,utcDateModified: this.utcDateModified};+ }++ getPojoToSave() {+ const pojo = this.getPojo();if (pojo.isProtected) {if (protectedSessionService.isProtectedSessionAvailable()) {diff --git a/src/public/app/services/froca_updater.js b/src/public/app/services/froca_updater.jsindex 5ac97a3d41..11aa7d9302 100644--- a/src/public/app/services/froca_updater.js+++ b/src/public/app/services/froca_updater.js@@ -25,6 +25,8 @@ async function processEntityChanges(entityChanges) {loadResults.addNoteContent(ec.entityId, ec.sourceId);} else if (ec.entityName === 'note_revisions') {loadResults.addNoteRevision(ec.entityId, ec.noteId, ec.sourceId);+ } else if (ec.entityName === 'note_revision_contents') {+ // this should change only when toggling isProtected, ignore} else if (ec.entityName === 'options') {if (ec.entity.name === 'openTabs') {continue; // only noise