delete note fixes

This commit is contained in:
zadam
2021-05-08 23:31:20 +02:00
parent 84246fd197
commit 9afea492db
9 changed files with 46 additions and 45 deletions

View File

@@ -523,7 +523,7 @@ function updateNote(noteId, noteUpdates) {
function deleteBranch(branch, deleteId, taskContext) {
taskContext.increaseProgressCount();
if (!branch || branch.isDeleted) {
if (!branch) {
return false;
}
@@ -531,7 +531,7 @@ function deleteBranch(branch, deleteId, taskContext) {
|| branch.noteId === 'root'
|| branch.noteId === cls.getHoistedNoteId()) {
throw new Error("Can't delete root branch/note");
throw new Error("Can't delete root or hoisted branch/note");
}
branch.markAsDeleted(deleteId);
@@ -546,8 +546,6 @@ function deleteBranch(branch, deleteId, taskContext) {
// first delete children and then parent - this will show up better in recent changes
note.markAsDeleted(deleteId);
log.info("Deleting note " + note.noteId);
for (const attribute of note.getOwnedAttributes()) {
@@ -558,6 +556,8 @@ function deleteBranch(branch, deleteId, taskContext) {
relation.markAsDeleted(deleteId);
}
note.markAsDeleted(deleteId);
return true;
}
else {
@@ -874,7 +874,7 @@ module.exports = {
scanForLinks,
duplicateSubtree,
duplicateSubtreeWithoutRoot,
getUndeletedParentBranches: getUndeletedParentBranchIds,
getUndeletedParentBranchIds,
triggerNoteTitleChanged,
eraseDeletedNotesNow
};