Skip to content

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

:bug: Abnormal heading block update time https://github.com/siyuan-note/siyuan/issues/11996

Daniel74c6b9ba0047
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 4a24bc0088..a15060e32e 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -320,8 +320,6 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
headingChildren = treenode.GetHeadingFold(headingChildren)
}
- refreshHeadingChildrenUpdated(srcNode, time.Now().Format("20060102150405"))
-
var srcEmptyList *ast.Node
if ast.NodeListItem == srcNode.Type && srcNode.Parent.FirstChild == srcNode && srcNode.Parent.LastChild == srcNode {
// 列表中唯一的列表项被移除后,该列表就为空了
@@ -374,8 +372,6 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
srcEmptyList.Unlink()
}
- refreshHeadingChildrenUpdated(srcNode, time.Now().Format("20060102150405"))
-
refreshUpdated(srcNode)
refreshUpdated(srcTree.Root)
if err = tx.writeTree(srcTree); nil != err {
@@ -454,8 +450,6 @@ func (tx *Transaction) doMove(operation *Operation) (ret *TxErr) {
}
}
- refreshHeadingChildrenUpdated(srcNode, time.Now().Format("20060102150405"))
-
refreshUpdated(srcNode)
refreshUpdated(srcTree.Root)
if err = tx.writeTree(srcTree); nil != err {
@@ -765,8 +759,6 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
node.Next.Unlink()
}
- refreshHeadingChildrenUpdated(node, time.Now().Format("20060102150405"))
-
node.Unlink()
if nil != parent && ast.NodeListItem == parent.Type && nil == parent.FirstChild {
// 保持空列表项
@@ -1026,8 +1018,6 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
}
}
- refreshHeadingChildrenUpdated(insertedNode, time.Now().Format("20060102150405"))
-
createdUpdated(insertedNode)
tx.nodes[insertedNode.ID] = insertedNode
if err = tx.writeTree(tree); nil != err {
@@ -1129,8 +1119,6 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
treenode.MoveFoldHeading(updatedNode, oldNode)
}
- refreshHeadingChildrenUpdated(oldNode, time.Now().Format("20060102150405"))
-
cache.PutBlockIAL(updatedNode.ID, parse.IAL2Map(updatedNode.KramdownIAL))
// 替换为新节点
@@ -1138,7 +1126,6 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
oldNode.Unlink()
createdUpdated(updatedNode)
- refreshHeadingChildrenUpdated(updatedNode, updatedNode.IALAttr("updated"))
tx.nodes[updatedNode.ID] = updatedNode
if err = tx.writeTree(tree); nil != err {
@@ -1151,19 +1138,6 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
return
}
-func refreshHeadingChildrenUpdated(heading *ast.Node, updated string) {
- if nil == heading || ast.NodeHeading != heading.Type {
- return
- }
-
- // 将非标题块更新为标题块时需要更新下方块的 parent id
- // The parent block field of the blocks under the heading block is calculated incorrectly https://github.com/siyuan-note/siyuan/issues/9869
- children := treenode.HeadingChildren(heading)
- for _, child := range children {
- child.SetIALAttr("updated", updated)
- }
-}
-
func upsertAvBlockRel(node *ast.Node) {
var avIDs []string
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {