check that note is not deleted before creating a branch

This commit is contained in:
azivner 2019-01-21 21:55:40 +01:00
parent ad7355372b
commit 7208a311ac

View file

@ -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,