mirror of
https://github.com/zadam/trilium.git
synced 2024-09-21 16:16:04 +08:00
check that note is not deleted before creating a branch
This commit is contained in:
parent
ad7355372b
commit
7208a311ac
|
@ -132,6 +132,12 @@ async function setNoteToParent(noteId, prefix, parentNoteId) {
|
|||
await branch.save();
|
||||
}
|
||||
else if (parentNoteId) {
|
||||
const note = await repository.getNote(noteId);
|
||||
|
||||
if (note.isDeleted) {
|
||||
throw new Error(`Cannot create a branch for ${noteId} which is deleted.`);
|
||||
}
|
||||
|
||||
await new Branch({
|
||||
noteId: noteId,
|
||||
parentNoteId: parentNoteId,
|
||||
|
|
Loading…
Reference in a new issue