mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01: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();
|
await branch.save();
|
||||||
}
|
}
|
||||||
else if (parentNoteId) {
|
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({
|
await new Branch({
|
||||||
noteId: noteId,
|
noteId: noteId,
|
||||||
parentNoteId: parentNoteId,
|
parentNoteId: parentNoteId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user