mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 22:08:48 +01:00
🎨 Identify the database view whether is a "mirror" https://github.com/siyuan-note/siyuan/issues/9578
This commit is contained in:
parent
029dfefd1f
commit
e964eddbeb
2 changed files with 42 additions and 0 deletions
|
|
@ -142,6 +142,33 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
|
|||
}
|
||||
|
||||
blockIDs := av.GetMirrorBlockIDs(avID)
|
||||
if 1 > len(blockIDs) {
|
||||
// 老数据兼容处理
|
||||
avBts := treenode.GetBlockTreesByType("av")
|
||||
for _, avBt := range avBts {
|
||||
if nil == avBt {
|
||||
continue
|
||||
}
|
||||
tree, _ := loadTreeByBlockID(avBt.ID)
|
||||
if nil == tree {
|
||||
continue
|
||||
}
|
||||
node := treenode.GetNodeInTree(tree, avBt.ID)
|
||||
if nil == node {
|
||||
continue
|
||||
}
|
||||
if avID == node.AttributeViewID {
|
||||
blockIDs = append(blockIDs, avBt.ID)
|
||||
}
|
||||
}
|
||||
if 1 > len(blockIDs) {
|
||||
continue
|
||||
}
|
||||
blockIDs = gulu.Str.RemoveDuplicatedElem(blockIDs)
|
||||
for _, blockID := range blockIDs {
|
||||
av.UpsertBlockRel(avID, blockID)
|
||||
}
|
||||
}
|
||||
|
||||
ret = append(ret, &BlockAttributeViewKeys{
|
||||
AvID: avID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue