Select accounts where empty string
This commit is contained in:
parent
31a24167fe
commit
de3b6bc6d9
|
@ -464,10 +464,18 @@ func (ps *postgresService) GetFollowersByAccountID(accountID string, followers *
|
||||||
q := ps.conn.Model(followers)
|
q := ps.conn.Model(followers)
|
||||||
|
|
||||||
if localOnly {
|
if localOnly {
|
||||||
|
// for local accounts let's get where domain is null OR where domain is an empty string, just to be safe
|
||||||
|
whereGroup := func(q *pg.Query) (*pg.Query, error) {
|
||||||
|
q = q.
|
||||||
|
WhereOr("? IS NULL", pg.Ident("a.domain")).
|
||||||
|
WhereOr("a.domain = ?", "")
|
||||||
|
return q, nil
|
||||||
|
}
|
||||||
|
|
||||||
q = q.ColumnExpr("follow.*").
|
q = q.ColumnExpr("follow.*").
|
||||||
Join("JOIN accounts AS a ON follow.account_id = TEXT(a.id)").
|
Join("JOIN accounts AS a ON follow.account_id = TEXT(a.id)").
|
||||||
Where("follow.target_account_id = ?", accountID).
|
Where("follow.target_account_id = ?", accountID).
|
||||||
Where("? IS NULL", pg.Ident("a.domain"))
|
WhereGroup(whereGroup)
|
||||||
} else {
|
} else {
|
||||||
q = q.Where("target_account_id = ?", accountID)
|
q = q.Where("target_account_id = ?", accountID)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue