summaryrefslogtreecommitdiff
path: root/internal/db/bundb/relationship.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-26 11:28:16 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-26 11:28:16 +0200
commitddc120d5e6e0f18f235a6b5bbe5ceec86efedc41 (patch)
tree08869fd4514e7ba67c57e81e001df0e1c329414c /internal/db/bundb/relationship.go
parentPg to bun (#148) (diff)
downloadgotosocial-ddc120d5e6e0f18f235a6b5bbe5ceec86efedc41.tar.xz
fix public timeline bug (#150)
Diffstat (limited to 'internal/db/bundb/relationship.go')
-rw-r--r--internal/db/bundb/relationship.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/internal/db/bundb/relationship.go b/internal/db/bundb/relationship.go
index ccc604baf..ed144669e 100644
--- a/internal/db/bundb/relationship.go
+++ b/internal/db/bundb/relationship.go
@@ -294,18 +294,10 @@ func (r *relationshipDB) GetAccountFollowedBy(ctx context.Context, accountID str
Model(&follows)
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 *bun.SelectQuery) *bun.SelectQuery {
- q = q.
- WhereOr("? IS NULL", bun.Ident("a.domain")).
- WhereOr("a.domain = ?", "")
- return q
- }
-
q = q.ColumnExpr("follow.*").
Join("JOIN accounts AS a ON follow.account_id = TEXT(a.id)").
Where("follow.target_account_id = ?", accountID).
- WhereGroup(" AND ", whereGroup)
+ WhereGroup(" AND ", whereEmptyOrNull("a.domain"))
} else {
q = q.Where("target_account_id = ?", accountID)
}