diff options
Diffstat (limited to 'internal/db/bundb/account.go')
-rw-r--r-- | internal/db/bundb/account.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/db/bundb/account.go b/internal/db/bundb/account.go index 9fc588207..50b0bfa38 100644 --- a/internal/db/bundb/account.go +++ b/internal/db/bundb/account.go @@ -263,10 +263,16 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li } if mediaOnly { + // attachments are stored as a json object; + // this implementation differs between sqlite and postgres, + // so we have to be very thorough to cover all eventualities q = q.WhereGroup(" AND ", func(q *bun.SelectQuery) *bun.SelectQuery { return q. - WhereOr("? IS NOT NULL", bun.Ident("attachments")). - WhereOr("attachments != '{}'") + Where("? IS NOT NULL", bun.Ident("attachments")). + Where("? != ''", bun.Ident("attachments")). + Where("? != 'null'", bun.Ident("attachments")). + Where("? != '{}'", bun.Ident("attachments")). + Where("? != '[]'", bun.Ident("attachments")) }) } |