got rid of "origParentNoteId" since it's not needed anymore

This commit is contained in:
zadam
2020-01-28 22:39:44 +01:00
parent 88213c1bbd
commit 976b2aa6f5
2 changed files with 7 additions and 20 deletions

View File

@@ -477,14 +477,14 @@ eventService.subscribe([eventService.ENTITY_CHANGED, eventService.ENTITY_DELETED
else if (entityName === 'branches') {
const branch = entity;
// first we remove records for original placement (if they exist)
childToParent[branch.noteId] = childToParent[branch.noteId] || [];
childToParent[branch.noteId] = childToParent[branch.noteId].filter(noteId => noteId !== branch.origParentNoteId);
if (branch.isDeleted) {
childToParent[branch.noteId] = childToParent[branch.noteId] || [];
childToParent[branch.noteId] = childToParent[branch.noteId].filter(noteId => noteId !== branch.parentNoteId);
delete prefixes[branch.noteId + '-' + branch.origParentNoteId];
delete childParentToBranchId[branch.noteId + '-' + branch.origParentNoteId];
if (!branch.isDeleted) {
delete prefixes[branch.noteId + '-' + branch.parentNoteId];
delete childParentToBranchId[branch.noteId + '-' + branch.parentNoteId];
}
else {
// ... and then we create new records
if (branch.prefix) {
prefixes[branch.noteId + '-' + branch.parentNoteId] = branch.prefix;