mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 00:35:50 +01:00
fixes to delete notifications
This commit is contained in:
@@ -101,11 +101,18 @@ async function setExpanded(req) {
|
||||
}
|
||||
|
||||
async function deleteBranch(req) {
|
||||
const last = req.query.last === 'true';
|
||||
const branch = await repository.getBranch(req.params.branchId);
|
||||
const taskContext = TaskContext.getInstance(req.query.taskId, 'delete-notes');
|
||||
|
||||
const noteDeleted = await notes.deleteBranch(branch, taskContext);
|
||||
|
||||
if (last) {
|
||||
taskContext.taskSucceeded();
|
||||
}
|
||||
|
||||
return {
|
||||
noteDeleted: await notes.deleteBranch(branch, taskContext)
|
||||
noteDeleted: noteDeleted
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,10 @@ async function importToBranch(req) {
|
||||
|
||||
if (last === "true") {
|
||||
// small timeout to avoid race condition (message is received before the transaction is committed)
|
||||
setTimeout(() => taskContext.taskSucceeded(parentNoteId, note.noteId), 1000);
|
||||
setTimeout(() => taskContext.taskSucceeded({
|
||||
parentNoteId: parentNoteId,
|
||||
importedNoteId: note.noteId
|
||||
}), 1000);
|
||||
}
|
||||
|
||||
// import has deactivated note events so note cache is not updated
|
||||
|
||||
@@ -75,14 +75,20 @@ async function updateNote(req) {
|
||||
|
||||
async function deleteNote(req) {
|
||||
const noteId = req.params.noteId;
|
||||
const taskId = req.query.taskId;
|
||||
const last = req.query.last === 'true';
|
||||
|
||||
const note = await repository.getNote(noteId);
|
||||
|
||||
const taskContext = TaskContext.getInstance(req.query.taskId, 'delete-notes');
|
||||
const taskContext = TaskContext.getInstance(taskId, 'delete-notes');
|
||||
|
||||
for (const branch of await note.getBranches()) {
|
||||
await noteService.deleteBranch(branch, taskContext);
|
||||
}
|
||||
|
||||
if (last) {
|
||||
await taskContext.taskSucceeded();
|
||||
}
|
||||
}
|
||||
|
||||
async function sortNotes(req) {
|
||||
|
||||
Reference in New Issue
Block a user