mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix consistency check to re-parent note from search parent to root
This commit is contained in:
parent
ade22ea825
commit
adf222b5e8
@ -443,10 +443,17 @@ class ConsistencyChecks {
|
|||||||
const branches = branchIds.map(branchId => becca.getBranch(branchId));
|
const branches = branchIds.map(branchId => becca.getBranch(branchId));
|
||||||
|
|
||||||
for (const branch of branches) {
|
for (const branch of branches) {
|
||||||
branch.parentNoteId = 'root';
|
// delete the old wrong branch
|
||||||
branch.save();
|
branch.markAsDeleted("parent-is-search");
|
||||||
|
|
||||||
logFix(`Child branch '${branch.branchId}' has been moved to root since it was a child of a search note '${parentNoteId}'`)
|
// create a replacement branch in root parent
|
||||||
|
new Branch({
|
||||||
|
parentNoteId: 'root',
|
||||||
|
noteId: branch.noteId,
|
||||||
|
prefix: 'recovered'
|
||||||
|
}).save();
|
||||||
|
|
||||||
|
logFix(`Note '${branch.noteId}' has been moved to root since it was a child of a search note '${parentNoteId}'`)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reloadNeeded = true;
|
this.reloadNeeded = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user