small refactorings and fixes

This commit is contained in:
zadam
2023-06-29 23:32:19 +02:00
parent 48029cea7c
commit eb34f9c64f
45 changed files with 78 additions and 188 deletions

View File

@@ -16,7 +16,7 @@ async function resolveNotePath(notePath, hoistedNoteId = 'root') {
/**
* Accepts notePath which might or might not be valid and returns an existing path as close to the original
* notePath as possible. Part of the path might not be valid because of note moving (which causes
* path change) or other corruption, in that case this will try to get some other valid path to the correct note.
* path change) or other corruption, in that case, this will try to get some other valid path to the correct note.
*
* @returns {Promise<string[]>}
*/
@@ -27,7 +27,7 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
notePath = notePath.split("?")[0].trim();
if (notePath.length === 0) {
return;
return null;
}
const path = notePath.split("/").reverse();
@@ -55,7 +55,7 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
ws.logError(`Can't find note ${childNoteId}`);
}
return;
return null;
}
child.sortParents();
@@ -67,7 +67,7 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
ws.logError(`No parents found for note ${childNoteId} (${child.title}) for path ${notePath}`);
}
return;
return null;
}
if (!parents.some(p => p.noteId === parentNoteId)) {