mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Automatically refresh reference counts after deleting or rolling back a document https://github.com/siyuan-note/siyuan/issues/12682
This commit is contained in:
parent
169e6a5bd5
commit
82b89af76c
2 changed files with 30 additions and 4 deletions
|
|
@ -315,6 +315,19 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
"refText": refText,
|
||||
}
|
||||
util.PushEvent(evt)
|
||||
|
||||
// 收集引用的定义块 ID
|
||||
refDefIDs := getRefDefIDs(tree.Root)
|
||||
// 推送定义节点引用计数
|
||||
for _, defID := range refDefIDs {
|
||||
defTree, _ := LoadTreeByBlockID(defID)
|
||||
if nil != defTree {
|
||||
defNode := treenode.GetNodeInTree(defTree, defID)
|
||||
if nil != defNode {
|
||||
task.AppendAsyncTaskWithDelay(task.SetDefRefCount, 1*time.Second, refreshRefCount, defTree.ID, defNode.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue