fix creating notes into options, #3517

This commit is contained in:
zadam 2023-01-13 11:34:35 +01:00
parent 9479f1c1a1
commit 60602a2264
2 changed files with 8 additions and 3 deletions

View file

@ -1358,7 +1358,7 @@ class Note extends AbstractEntity {
}
isOptions() {
return this.noteId.startsWith("options");
return this.noteId.startsWith("_options");
}
get isDeleted() {

View file

@ -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;