mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🎨 The database-bound block is automatically added to the database after being copied as a replica https://github.com/siyuan-note/siyuan/issues/12140
This commit is contained in:
parent
0d5af87da2
commit
3cbb6138ed
2 changed files with 33 additions and 28 deletions
|
|
@ -1653,6 +1653,7 @@ func removeDoc(box *Box, p string, luteEngine *lute.Lute) {
|
|||
|
||||
allRemoveRootIDs := []string{tree.ID}
|
||||
allRemoveRootIDs = append(allRemoveRootIDs, removeIDs...)
|
||||
allRemoveRootIDs = gulu.Str.RemoveDuplicatedElem(allRemoveRootIDs)
|
||||
for _, rootID := range allRemoveRootIDs {
|
||||
removeTree, _ := LoadTreeByBlockID(rootID)
|
||||
if nil == removeTree {
|
||||
|
|
|
|||
|
|
@ -780,16 +780,21 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
|
|||
func syncDelete2Block(node *ast.Node) {
|
||||
var changedAvIDs []string
|
||||
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
if !entering || ast.NodeAttributeView != n.Type {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if ast.NodeAttributeView == n.Type {
|
||||
avID := n.AttributeViewID
|
||||
isMirror := av.IsMirror(avID)
|
||||
if changed := av.RemoveBlockRel(avID, n.ID, treenode.ExistBlockTree); changed {
|
||||
changedAvIDs = append(changedAvIDs, avID)
|
||||
}
|
||||
|
||||
if isMirror {
|
||||
// 删除镜像数据库节点后不需要解绑块,因为其他镜像节点还在使用
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
return ast.WalkContinue
|
||||
|
|
@ -815,7 +820,6 @@ func syncDelete2Block(node *ast.Node) {
|
|||
for _, tree := range trees {
|
||||
indexWriteTreeUpsertQueue(tree)
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
changedAvIDs = gulu.Str.RemoveDuplicatedElem(changedAvIDs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue