fixes to delete notifications

This commit is contained in:
zadam
2019-10-19 00:11:07 +02:00
parent 9f4ca279aa
commit 82bbf4173b
8 changed files with 50 additions and 15 deletions

View File

@@ -108,14 +108,21 @@ async function deleteNodes(nodes) {
const taskId = utils.randomString(10);
let counter = 0;
for (const node of nodes) {
counter++;
const last = counter === nodes.length;
const query = `?taskId=${taskId}&last=${last ? 'true' : 'false'}`;
if (deleteClones) {
await server.remove('notes/' + node.data.noteId + '?taskId=' + taskId);
await server.remove(`notes/${node.data.noteId}` + query);
noteDetailService.noteDeleted(node.data.noteId);
}
else {
const {noteDeleted} = await server.remove('branches/' + node.data.branchId + '?taskId=' + taskId);
const {noteDeleted} = await server.remove(`branches/${node.data.branchId}` + query);
if (noteDeleted) {
noteDetailService.noteDeleted(node.data.noteId);
@@ -167,8 +174,6 @@ async function deleteNodes(nodes) {
node.setFocus(true);
}
infoService.showMessage("Note(s) has been deleted.");
return true;
}