can't create non-launcher notes into the launcher subtree

This commit is contained in:
zadam 2022-12-18 20:12:43 +01:00
parent e5171e434b
commit db6dbc7821

View File

@ -104,6 +104,10 @@ function getAndValidateParent(params) {
throw new ValidationError(`Creating child notes into launcher notes is not allowed.`); throw new ValidationError(`Creating child notes into launcher notes is not allowed.`);
} }
if (['lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(params.parentNoteId) && params.type !== 'launcher') {
throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);
}
if (!params.ignoreForbiddenParents && (['lbRoot', 'hidden'].includes(parentNote.noteId) || parentNote.isOptions())) { if (!params.ignoreForbiddenParents && (['lbRoot', 'hidden'].includes(parentNote.noteId) || parentNote.isOptions())) {
throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`); throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);
} }