mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🔥 The database-bound block no longer automatically adds to the database after being copied as a replica https://github.com/siyuan-note/siyuan/issues/12294
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
3f3afb3347
commit
62bdaf9ec6
2 changed files with 9 additions and 39 deletions
|
|
@ -981,24 +981,14 @@ func DuplicateDoc(tree *parse.Tree) {
|
|||
}
|
||||
FlushTxQueue()
|
||||
|
||||
// 复制为副本时将该副本块插入到数据库中 https://github.com/siyuan-note/siyuan/issues/11959
|
||||
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering || !n.IsBlock() {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
avs := n.IALAttr(av.NodeAttrNameAvs)
|
||||
for _, avID := range strings.Split(avs, ",") {
|
||||
if !ast.IsNodeIDPattern(avID) {
|
||||
continue
|
||||
}
|
||||
|
||||
AddAttributeViewBlock(nil, []map[string]interface{}{{
|
||||
"id": n.ID,
|
||||
"isDetached": false,
|
||||
}}, avID, "", "", "", "", true, map[string]interface{}{})
|
||||
ReloadAttrView(avID)
|
||||
}
|
||||
n.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||
n.RemoveIALAttr(av.NodeAttrViewNames)
|
||||
return ast.WalkContinue
|
||||
})
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1206,19 +1206,9 @@ func (tx *Transaction) doLargeInsert(previousID string) (ret *TxErr) {
|
|||
|
||||
upsertAvBlockRel(insertedNode)
|
||||
|
||||
// 复制为副本时将该副本块插入到数据库中 https://github.com/siyuan-note/siyuan/issues/11959
|
||||
avs := insertedNode.IALAttr(av.NodeAttrNameAvs)
|
||||
for _, avID := range strings.Split(avs, ",") {
|
||||
if !ast.IsNodeIDPattern(avID) {
|
||||
continue
|
||||
}
|
||||
|
||||
AddAttributeViewBlock(tx, []map[string]interface{}{{
|
||||
"id": insertedNode.ID,
|
||||
"isDetached": false,
|
||||
}}, avID, "", "", "", previousID, true, map[string]interface{}{})
|
||||
ReloadAttrView(avID)
|
||||
}
|
||||
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||
insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
|
||||
|
||||
if ast.NodeAttributeView == insertedNode.Type {
|
||||
// 插入数据库块时需要重新绑定其中已经存在的块
|
||||
|
|
@ -1394,19 +1384,9 @@ 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, ",") {
|
||||
if !ast.IsNodeIDPattern(avID) {
|
||||
continue
|
||||
}
|
||||
|
||||
AddAttributeViewBlock(tx, []map[string]interface{}{{
|
||||
"id": insertedNode.ID,
|
||||
"isDetached": false,
|
||||
}}, avID, "", "", "", previousID, true, map[string]interface{}{})
|
||||
ReloadAttrView(avID)
|
||||
}
|
||||
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||
insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
|
||||
|
||||
if ast.NodeAttributeView == insertedNode.Type {
|
||||
// 插入数据库块时需要重新绑定其中已经存在的块
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue