unified/simplified protecting notes & subtree

This commit is contained in:
zadam
2020-02-26 16:37:17 +01:00
parent 3752cf8cba
commit 7bcae9981b
13 changed files with 84 additions and 90 deletions

View File

@@ -83,14 +83,15 @@ async function sortNotes(req) {
await treeService.sortNotesAlphabetically(noteId);
}
async function protectSubtree(req) {
async function protectNote(req) {
const noteId = req.params.noteId;
const note = await repository.getNote(noteId);
const protect = !!parseInt(req.params.isProtected);
const includingSubTree = !!parseInt(req.query.subtree);
const taskContext = new TaskContext(utils.randomString(10), 'protect-notes', {protect});
await noteService.protectNoteRecursively(note, protect, taskContext);
await noteService.protectNoteRecursively(note, protect, includingSubTree, taskContext);
taskContext.taskSucceeded();
}
@@ -183,7 +184,7 @@ module.exports = {
undeleteNote,
createNote,
sortNotes,
protectSubtree,
protectNote,
setNoteTypeMime,
getRelationMap,
changeTitle,