mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-29 11:46:09 +01:00
This commit is contained in:
parent
68b0f4e8b3
commit
1085926f8d
2 changed files with 18 additions and 1 deletions
|
|
@ -1258,7 +1258,7 @@ func autoFixIndex() {
|
|||
|
||||
redundantPaths := treenode.GetRedundantPaths(box.ID, paths)
|
||||
for _, p := range redundantPaths {
|
||||
treenode.RemoveBlockTreesByPathPrefix(p)
|
||||
treenode.RemoveBlockTreesByPath(p)
|
||||
}
|
||||
|
||||
missingPaths := treenode.GetNotExistPaths(box.ID, paths)
|
||||
|
|
|
|||
|
|
@ -224,6 +224,23 @@ func RemoveBlockTreesByRootID(rootID string) {
|
|||
blockTreesChanged = true
|
||||
}
|
||||
|
||||
func RemoveBlockTreesByPath(path string) {
|
||||
blockTreesLock.Lock()
|
||||
defer blockTreesLock.Unlock()
|
||||
|
||||
var ids []string
|
||||
for _, b := range blockTrees {
|
||||
if b.Path == path {
|
||||
ids = append(ids, b.ID)
|
||||
}
|
||||
}
|
||||
ids = gulu.Str.RemoveDuplicatedElem(ids)
|
||||
for _, id := range ids {
|
||||
delete(blockTrees, id)
|
||||
}
|
||||
blockTreesChanged = true
|
||||
}
|
||||
|
||||
func RemoveBlockTreesByPathPrefix(pathPrefix string) {
|
||||
blockTreesLock.Lock()
|
||||
defer blockTreesLock.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue