Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve block update time filling https://github.com/siyuan-note/siyuan/issues/12182

Daniel27c19ba39697
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index cca2af8fbf..fcaa6d5cec 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -1253,13 +1253,32 @@ func refreshUpdated(node *ast.Node) {
}
func createdUpdated(node *ast.Node) {
+ // 补全子节点的更新时间 Improve block update time filling https://github.com/siyuan-note/siyuan/issues/12182
+ ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
+ if !entering || !n.IsBlock() || ast.NodeKramdownBlockIAL == n.Type {
+ return ast.WalkContinue
+ }
+
+ updated := n.IALAttr("updated")
+ if "" == updated && ast.IsNodeIDPattern(n.ID) {
+ created := util.TimeFromID(n.ID)
+ updated = created
+ if updated < created {
+ updated = created
+ }
+
+ n.SetIALAttr("updated", updated)
+ }
+ return ast.WalkContinue
+ })
+
created := util.TimeFromID(node.ID)
updated := node.IALAttr("updated")
if "" == updated {
updated = created
}
if updated < created {
- updated = created // 复制粘贴块后创建时间小于更新时间 https://github.com/siyuan-note/siyuan/issues/3624
+ updated = created
}
parents := treenode.ParentNodesWithHeadings(node)
for _, parent := range parents { // 更新所有父节点的更新时间字段