[bugfix] Fix broken only_media and only_public flags on /api/v1/accounts/:id/statuses (#448)

* bump superseriousbusiness/activity version

* fetch list of follower inbox iris

* add test for getting account statuses

* fix incorrect publicOnly parsing

* update media not null query
This commit is contained in:
tobi 2022-04-10 15:11:12 +02:00 committed by GitHub
commit a7e9dee33d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 5 deletions

View file

@ -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"))
})
}