diff options
author | 2024-02-27 09:18:40 -0800 | |
---|---|---|
committer | 2024-02-27 18:18:40 +0100 | |
commit | ad28b9f16661b36af9c9b4ed0bb2a7740167c934 (patch) | |
tree | fb38a9e77ecd8349b4431b0b0578dba009b745bf /internal/db/bundb/account.go | |
parent | [feature] add script to test import / export cycle of a gotosocial instance (... (diff) | |
download | gotosocial-ad28b9f16661b36af9c9b4ed0bb2a7740167c934.tar.xz |
[bugfix] Account timeline: exclude self-replies that mention other accounts (#2670)
* Account timeline: exclude self-replies that mention other accounts
* Add index for querying unmentioned statuses
* remove now unused statuses_account_id_id_idx
---------
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/db/bundb/account.go')
-rw-r--r-- | internal/db/bundb/account.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/db/bundb/account.go b/internal/db/bundb/account.go index e0d574f62..d2c9c2f51 100644 --- a/internal/db/bundb/account.go +++ b/internal/db/bundb/account.go @@ -604,13 +604,16 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li Where("? = ?", bun.Ident("status.account_id"), accountID) if excludeReplies { - q = q.WhereGroup(" AND ", func(*bun.SelectQuery) *bun.SelectQuery { + q = q.WhereGroup(" AND ", func(q *bun.SelectQuery) *bun.SelectQuery { return q. // Do include self replies (threads), but // don't include replies to other people. Where("? = ?", bun.Ident("status.in_reply_to_account_id"), accountID). WhereOr("? IS NULL", bun.Ident("status.in_reply_to_uri")) }) + // Don't include replies that mention other people: + // for example, an account's reply to its own reply to someone else. + q = whereArrayIsNullOrEmpty(q, bun.Ident("status.mentions")) } if excludeReblogs { |