mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 The backlink panel no longer displays child-block references https://github.com/siyuan-note/siyuan/issues/12861
This commit is contained in:
parent
ae32c69bdd
commit
e2b2d46a47
4 changed files with 12 additions and 21 deletions
|
|
@ -389,26 +389,17 @@ func QueryRefsRecent(onlyDoc bool, typeFilter string, ignoreLines []string) (ret
|
|||
}
|
||||
|
||||
func QueryRefsByDefID(defBlockID string, containChildren bool) (ret []*Ref) {
|
||||
sqlBlock := GetBlock(defBlockID)
|
||||
if nil == sqlBlock {
|
||||
return
|
||||
}
|
||||
|
||||
var rows *sql.Rows
|
||||
var err error
|
||||
if "d" == sqlBlock.Type {
|
||||
rows, err = query("SELECT * FROM refs WHERE def_block_root_id = ?", defBlockID)
|
||||
} else {
|
||||
if containChildren {
|
||||
blockIDs := queryBlockChildrenIDs(defBlockID)
|
||||
var params []string
|
||||
for _, id := range blockIDs {
|
||||
params = append(params, "\""+id+"\"")
|
||||
}
|
||||
rows, err = query("SELECT * FROM refs WHERE def_block_id IN (" + strings.Join(params, ",") + ")")
|
||||
} else {
|
||||
rows, err = query("SELECT * FROM refs WHERE def_block_id = ?", defBlockID)
|
||||
if containChildren {
|
||||
blockIDs := queryBlockChildrenIDs(defBlockID)
|
||||
var params []string
|
||||
for _, id := range blockIDs {
|
||||
params = append(params, "\""+id+"\"")
|
||||
}
|
||||
rows, err = query("SELECT * FROM refs WHERE def_block_id IN (" + strings.Join(params, ",") + ")")
|
||||
} else {
|
||||
rows, err = query("SELECT * FROM refs WHERE def_block_id = ?", defBlockID)
|
||||
}
|
||||
if err != nil {
|
||||
logging.LogErrorf("sql query failed: %s", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue