protection against deleting root note

This commit is contained in:
azivner
2018-08-30 22:38:34 +02:00
parent 0442a44aab
commit ce9805c5bc
3 changed files with 7 additions and 1 deletions

View File

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