fix path resolution bug when path is outside of hosted subtree

This commit is contained in:
zadam 2022-11-27 15:50:01 +01:00
parent 6a9ac6f90a
commit e4f57ab2fe
2 changed files with 4 additions and 3 deletions

View File

@ -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) {

View File

@ -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.`};
}