mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
protection against deleting root note
This commit is contained in:
@@ -248,6 +248,10 @@ async function deleteNote(branch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (branch.branchId === 'root' || branch.noteId === 'root') {
|
||||
throw new Error("Can't delete root branch/note");
|
||||
}
|
||||
|
||||
branch.isDeleted = true;
|
||||
await branch.save();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ async function validateParentChild(parentNoteId, childNoteId, branchId = null) {
|
||||
if (!await checkTreeCycle(parentNoteId, childNoteId)) {
|
||||
return {
|
||||
success: false,
|
||||
message: 'Moving note here would create cycle.'
|
||||
message: 'Moving/cloning note here would create cycle.'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user