mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 15:56:16 -06:00
[bugfix] Fix top-level posts with a mention being counted as replies
This commit is contained in:
parent
2a46681147
commit
02595e0d72
1 changed files with 10 additions and 7 deletions
|
|
@ -899,15 +899,18 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li
|
||||||
|
|
||||||
if excludeReplies {
|
if excludeReplies {
|
||||||
q = q.WhereGroup(" AND ", func(q *bun.SelectQuery) *bun.SelectQuery {
|
q = q.WhereGroup(" AND ", func(q *bun.SelectQuery) *bun.SelectQuery {
|
||||||
|
// We're excluding replies so...
|
||||||
return q.
|
return q.
|
||||||
// Do include self replies (threads), but
|
// 1. Include posts that don't reply to anything AND
|
||||||
// don't include replies to other people.
|
Where("? IS NULL", bun.Ident("status.in_reply_to_uri")).
|
||||||
Where("? = ?", bun.Ident("status.in_reply_to_account_id"), accountID).
|
// 2. Include posts that reply to self AND don't
|
||||||
WhereOr("? IS NULL", bun.Ident("status.in_reply_to_uri"))
|
// mention anyone (ie., self-reply threads).
|
||||||
|
WhereGroup(" OR ", func(q *bun.SelectQuery) *bun.SelectQuery {
|
||||||
|
q = q.Where("? = ?", bun.Ident("status.in_reply_to_account_id"), accountID)
|
||||||
|
q = whereArrayIsNullOrEmpty(q, bun.Ident("status.mentions"))
|
||||||
|
return q
|
||||||
|
})
|
||||||
})
|
})
|
||||||
// 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 {
|
if excludeReblogs {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue