🐛 Blocks created via template update time earlier than creation time Fix https://github.com/siyuan-note/siyuan/issues/8607

This commit is contained in:
Daniel 2023-06-24 20:26:15 +08:00
parent 5e16149c4c
commit 32dee71bb9
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 6 additions and 3 deletions

View file

@ -250,6 +250,9 @@ func renderTemplate(p, id string) (string, error) {
// 重新生成 ID
n.ID = ast.NewNodeID()
n.SetIALAttr("id", n.ID)
// Blocks created via template update time earlier than creation time https://github.com/siyuan-note/siyuan/issues/8607
refreshUpdated(n)
}
if (ast.NodeListItem == n.Type && (nil == n.FirstChild ||

View file

@ -989,10 +989,10 @@ func (tx *Transaction) doSetAttrs(operation *Operation) (ret *TxErr) {
return
}
func refreshUpdated(n *ast.Node) {
func refreshUpdated(node *ast.Node) {
updated := util.CurrentTimeSecondsStr()
n.SetIALAttr("updated", updated)
parents := treenode.ParentNodes(n)
node.SetIALAttr("updated", updated)
parents := treenode.ParentNodes(node)
for _, parent := range parents { // 更新所有父节点的更新时间字段
parent.SetIALAttr("updated", updated)
}