mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 10:12:26 -05:00
[bugfix] Status visibility + excludeReplies fixes (#769)
* Fix some bugs when viewing a user's posts: include their self-replies (threads) even when excludeReplies is set, and use in_reply_to_uri instead of in_reply_to_id to filter out replies * Assign values to InReplyToURI when creating statuses. Add index and update old statuses with a migration
This commit is contained in:
parent
4c60a142f8
commit
54f6caed65
3 changed files with 76 additions and 2 deletions
|
|
@ -270,7 +270,14 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li
|
|||
}
|
||||
|
||||
if excludeReplies {
|
||||
q = q.WhereGroup(" AND ", whereEmptyOrNull("in_reply_to_id"))
|
||||
// include self-replies (threads)
|
||||
whereGroup := func(*bun.SelectQuery) *bun.SelectQuery {
|
||||
return q.
|
||||
WhereOr("in_reply_to_account_id = ?", accountID).
|
||||
WhereGroup(" OR ", whereEmptyOrNull("in_reply_to_uri"))
|
||||
}
|
||||
|
||||
q = q.WhereGroup(" AND ", whereGroup)
|
||||
}
|
||||
|
||||
if excludeReblogs {
|
||||
|
|
@ -332,7 +339,7 @@ func (a *accountDB) GetAccountWebStatuses(ctx context.Context, accountID string,
|
|||
Table("statuses").
|
||||
Column("id").
|
||||
Where("account_id = ?", accountID).
|
||||
WhereGroup(" AND ", whereEmptyOrNull("in_reply_to_id")).
|
||||
WhereGroup(" AND ", whereEmptyOrNull("in_reply_to_uri")).
|
||||
WhereGroup(" AND ", whereEmptyOrNull("boost_of_id")).
|
||||
Where("visibility = ?", gtsmodel.VisibilityPublic).
|
||||
Where("federated = ?", true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue