summaryrefslogtreecommitdiff
path: root/internal/db/bundb/account.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-04-10 15:11:12 +0200
committerLibravatar GitHub <noreply@github.com>2022-04-10 15:11:12 +0200
commita7e9dee33d038c55090b1e657fdf1008d3c4e227 (patch)
tree30e8995596d9f022479115a49d3c23c3bde5dd80 /internal/db/bundb/account.go
parent[dependency] Update superseriousbusiness/activity dependency (#446) (diff)
downloadgotosocial-a7e9dee33d038c55090b1e657fdf1008d3c4e227.tar.xz
[bugfix] Fix broken only_media and only_public flags on /api/v1/accounts/:id/statuses (#448)v0.2.3
* 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
Diffstat (limited to 'internal/db/bundb/account.go')
-rw-r--r--internal/db/bundb/account.go10
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"))
})
}