From e4f57ab2fe7cc7a55dc586713319f32d84f1fc5a Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 27 Nov 2022 15:50:01 +0100 Subject: [PATCH] fix path resolution bug when path is outside of hosted subtree --- src/becca/becca_service.js | 5 +++-- src/services/tree.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/becca/becca_service.js b/src/becca/becca_service.js index 929be2213..4337903b0 100644 --- a/src/becca/becca_service.js +++ b/src/becca/becca_service.js @@ -129,8 +129,9 @@ function getNoteTitleForPath(notePathArray) { */ function getSomePath(note, path = []) { // first try to find note within hoisted note, otherwise take any existing note path - return getSomePathInner(note, path, true) - || getSomePathInner(note, path, false); + // each branch needs a separate copy since it's mutable + return getSomePathInner(note, [...path], true) + || getSomePathInner(note, [...path], false); } function getSomePathInner(note, path, respectHoisting) { diff --git a/src/services/tree.js b/src/services/tree.js index aa9983cbc..4d2c04d97 100644 --- a/src/services/tree.js +++ b/src/services/tree.js @@ -30,7 +30,7 @@ function getNotes(noteIds) { } function validateParentChild(parentNoteId, childNoteId, branchId = null) { - if (['root', 'hidden'].includes(childNoteId)) { + if (['root', 'hidden', 'share', 'lb_root', 'lb_availableshortcuts', 'lb_visibleshortcuts'].includes(childNoteId)) { return { success: false, message: `Cannot change this note's location.`}; }