mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +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()
|
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 {
|
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||||
if !entering || !n.IsBlock() {
|
if !entering || !n.IsBlock() {
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
avs := n.IALAttr(av.NodeAttrNameAvs)
|
n.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||||
for _, avID := range strings.Split(avs, ",") {
|
n.RemoveIALAttr(av.NodeAttrViewNames)
|
||||||
if !ast.IsNodeIDPattern(avID) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
AddAttributeViewBlock(nil, []map[string]interface{}{{
|
|
||||||
"id": n.ID,
|
|
||||||
"isDetached": false,
|
|
||||||
}}, avID, "", "", "", "", true, map[string]interface{}{})
|
|
||||||
ReloadAttrView(avID)
|
|
||||||
}
|
|
||||||
return ast.WalkContinue
|
return ast.WalkContinue
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1206,19 +1206,9 @@ func (tx *Transaction) doLargeInsert(previousID string) (ret *TxErr) {
|
||||||
|
|
||||||
upsertAvBlockRel(insertedNode)
|
upsertAvBlockRel(insertedNode)
|
||||||
|
|
||||||
// 复制为副本时将该副本块插入到数据库中 https://github.com/siyuan-note/siyuan/issues/11959
|
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||||
avs := insertedNode.IALAttr(av.NodeAttrNameAvs)
|
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||||
for _, avID := range strings.Split(avs, ",") {
|
insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
|
||||||
if !ast.IsNodeIDPattern(avID) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
AddAttributeViewBlock(tx, []map[string]interface{}{{
|
|
||||||
"id": insertedNode.ID,
|
|
||||||
"isDetached": false,
|
|
||||||
}}, avID, "", "", "", previousID, true, map[string]interface{}{})
|
|
||||||
ReloadAttrView(avID)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ast.NodeAttributeView == insertedNode.Type {
|
if ast.NodeAttributeView == insertedNode.Type {
|
||||||
// 插入数据库块时需要重新绑定其中已经存在的块
|
// 插入数据库块时需要重新绑定其中已经存在的块
|
||||||
|
|
@ -1394,19 +1384,9 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
|
||||||
|
|
||||||
upsertAvBlockRel(insertedNode)
|
upsertAvBlockRel(insertedNode)
|
||||||
|
|
||||||
// 复制为副本时将该副本块插入到数据库中 https://github.com/siyuan-note/siyuan/issues/11959
|
// 复制为副本时移除数据库绑定状态 https://github.com/siyuan-note/siyuan/issues/12294
|
||||||
avs := insertedNode.IALAttr(av.NodeAttrNameAvs)
|
insertedNode.RemoveIALAttr(av.NodeAttrNameAvs)
|
||||||
for _, avID := range strings.Split(avs, ",") {
|
insertedNode.RemoveIALAttr(av.NodeAttrViewNames)
|
||||||
if !ast.IsNodeIDPattern(avID) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
AddAttributeViewBlock(tx, []map[string]interface{}{{
|
|
||||||
"id": insertedNode.ID,
|
|
||||||
"isDetached": false,
|
|
||||||
}}, avID, "", "", "", previousID, true, map[string]interface{}{})
|
|
||||||
ReloadAttrView(avID)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ast.NodeAttributeView == insertedNode.Type {
|
if ast.NodeAttributeView == insertedNode.Type {
|
||||||
// 插入数据库块时需要重新绑定其中已经存在的块
|
// 插入数据库块时需要重新绑定其中已经存在的块
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue