mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 21:05:55 +01:00
Merge branch 'master' into canvas
This commit is contained in:
@@ -28,10 +28,7 @@ async function checkTreeCycles(errorList) {
|
||||
const childNoteId = row.noteId;
|
||||
const parentNoteId = row.parentNoteId;
|
||||
|
||||
if (!childToParents[childNoteId]) {
|
||||
childToParents[childNoteId] = [];
|
||||
}
|
||||
|
||||
childToParents[childNoteId] = childToParents[childNoteId] || [];
|
||||
childToParents[childNoteId].push(parentNoteId);
|
||||
}
|
||||
|
||||
@@ -40,6 +37,11 @@ async function checkTreeCycles(errorList) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!childToParents[noteId] || childToParents[noteId].length === 0) {
|
||||
errorList.push(`No parents found for noteId=${noteId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const parentNoteId of childToParents[noteId]) {
|
||||
if (path.includes(parentNoteId)) {
|
||||
errorList.push(`Tree cycle detected at parent-child relationship: ${parentNoteId} - ${noteId}, whole path: ${path}`);
|
||||
@@ -58,6 +60,10 @@ async function checkTreeCycles(errorList) {
|
||||
for (const noteId of noteIds) {
|
||||
checkTreeCycle(noteId, [], errorList);
|
||||
}
|
||||
|
||||
if (childToParents['root'].length !== 1 || childToParents['root'][0] !== 'none') {
|
||||
errorList.push('Incorrect root parent: ' + JSON.stringify(childToParents['root']));
|
||||
}
|
||||
}
|
||||
|
||||
async function runSyncRowChecks(table, key, errorList) {
|
||||
|
||||
Reference in New Issue
Block a user