🐛 Blocks created via template update time earlier than creation time Fix https://github.com/siyuan-note/siyuan/issues/8607
This commit is contained in:
parent
5e16149c4c
commit
32dee71bb9
2 changed files with 6 additions and 3 deletions
|
@ -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 ||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue