From ddc120d5e6e0f18f235a6b5bbe5ceec86efedc41 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 26 Aug 2021 11:28:16 +0200 Subject: fix public timeline bug (#150) --- internal/db/bundb/instance.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'internal/db/bundb/instance.go') diff --git a/internal/db/bundb/instance.go b/internal/db/bundb/instance.go index f9364346e..141b255cf 100644 --- a/internal/db/bundb/instance.go +++ b/internal/db/bundb/instance.go @@ -41,7 +41,7 @@ func (i *instanceDB) CountInstanceUsers(ctx context.Context, domain string) (int if domain == i.config.Host { // if the domain is *this* domain, just count where the domain field is null - q = q.Where("? IS NULL", bun.Ident("domain")) + q = q.WhereGroup(" AND ", whereEmptyOrNull("domain")) } else { q = q.Where("domain = ?", domain) } @@ -83,7 +83,9 @@ func (i *instanceDB) CountInstanceDomains(ctx context.Context, domain string) (i if domain == i.config.Host { // if the domain is *this* domain, just count other instances it knows about // exclude domains that are blocked - q = q.Where("domain != ?", domain).Where("? IS NULL", bun.Ident("suspended_at")) + q = q. + Where("domain != ?", domain). + Where("? IS NULL", bun.Ident("suspended_at")) } else { // TODO: implement federated domain counting properly for remote domains return 0, nil -- cgit v1.2.3