mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 After the document is transferred to the heading, occurs two copies of the reference block Fix https://github.com/siyuan-note/siyuan/issues/7819
This commit is contained in:
parent
c804ce77fc
commit
ee7ab26fcd
3 changed files with 31 additions and 1 deletions
|
|
@ -44,7 +44,7 @@ type dbQueueOperation struct {
|
|||
action string // upsert/delete/delete_id/rename/rename_sub_tree/delete_box/delete_box_refs/insert_refs/index/delete_ids/update_block_content/delete_assets
|
||||
|
||||
indexPath string // index
|
||||
upsertTree *parse.Tree // upsert/insert_refs
|
||||
upsertTree *parse.Tree // upsert/insert_refs/update_refs/delete_refs
|
||||
removeTreeBox, removeTreePath string // delete
|
||||
removeTreeIDBox, removeTreeID string // delete_id
|
||||
removeTreeIDs []string // delete_ids
|
||||
|
|
@ -182,6 +182,8 @@ func execOp(op *dbQueueOperation, tx *sql.Tx, context map[string]interface{}) (e
|
|||
err = insertRefs(tx, op.upsertTree)
|
||||
case "update_refs":
|
||||
err = upsertRefs(tx, op.upsertTree)
|
||||
case "delete_refs":
|
||||
err = deleteRefs(tx, op.upsertTree)
|
||||
case "update_block_content":
|
||||
err = updateBlockContent(tx, op.block)
|
||||
case "delete_assets":
|
||||
|
|
@ -220,6 +222,20 @@ func UpdateBlockContentQueue(block *Block) {
|
|||
operationQueue = append(operationQueue, newOp)
|
||||
}
|
||||
|
||||
func DeleteRefsTreeQueue(tree *parse.Tree) {
|
||||
dbQueueLock.Lock()
|
||||
defer dbQueueLock.Unlock()
|
||||
|
||||
newOp := &dbQueueOperation{upsertTree: tree, inQueueTime: time.Now(), action: "delete_refs"}
|
||||
for i, op := range operationQueue {
|
||||
if "delete_refs" == op.action && op.upsertTree.ID == tree.ID {
|
||||
operationQueue[i] = newOp
|
||||
return
|
||||
}
|
||||
}
|
||||
operationQueue = append(operationQueue, newOp)
|
||||
}
|
||||
|
||||
func UpdateRefsTreeQueue(tree *parse.Tree) {
|
||||
dbQueueLock.Lock()
|
||||
defer dbQueueLock.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue