diff --git a/internal/db/pg/pg.go b/internal/db/pg/pg.go index 5c6720a..d4f8d10 100644 --- a/internal/db/pg/pg.go +++ b/internal/db/pg/pg.go @@ -464,10 +464,18 @@ func (ps *postgresService) GetFollowersByAccountID(accountID string, followers * q := ps.conn.Model(followers) 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.*"). Join("JOIN accounts AS a ON follow.account_id = TEXT(a.id)"). Where("follow.target_account_id = ?", accountID). - Where("? IS NULL", pg.Ident("a.domain")) + WhereGroup(whereGroup) } else { q = q.Where("target_account_id = ?", accountID) }