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 creating notes into options, #3517
zadam60602a2264d1
diff --git a/src/becca/entities/note.js b/src/becca/entities/note.jsindex 00140a7d11..3a994a5077 100644--- a/src/becca/entities/note.js+++ b/src/becca/entities/note.js@@ -1358,7 +1358,7 @@ class Note extends AbstractEntity {}isOptions() {- return this.noteId.startsWith("options");+ return this.noteId.startsWith("_options");}get isDeleted() {diff --git a/src/services/notes.js b/src/services/notes.jsindex 95dff2ec31..813e75bc64 100644--- a/src/services/notes.js+++ b/src/services/notes.js@@ -108,8 +108,13 @@ function getAndValidateParent(params) {throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);}- if (!params.ignoreForbiddenParents && (['_lbRoot', '_hidden'].includes(parentNote.noteId) || parentNote.isOptions())) {- throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);+ if (!params.ignoreForbiddenParents) {+ if (['_lbRoot', '_hidden'].includes(parentNote.noteId)+ || parentNote.noteId.startsWith("_lbTpl")+ || parentNote.isOptions()) {++ throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);+ }}return parentNote;