Skip to content

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

:art: The database-bound block is automatically added to the database after being copied as a replica https://github.com/siyuan-note/siyuan/issues/11959

Daniel935efd7d3d91
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index e7d86f515c..cef6b50bac 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -1036,6 +1036,16 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
upsertAvBlockRel(insertedNode)
+ // 复制为副本时将该副本块插入到数据库中 https://github.com/siyuan-note/siyuan/issues/11959
+ avs := insertedNode.IALAttr(av.NodeAttrNameAvs)
+ for _, avID := range strings.Split(avs, ",") {
+ AddAttributeViewBlock(tx, []map[string]interface{}{{
+ "id": insertedNode.ID,
+ "isDetached": false,
+ }}, avID, "", previousID, false)
+ util.PushReloadAttrView(avID)
+ }
+
operation.ID = insertedNode.ID
operation.ParentID = insertedNode.Parent.ID