From 2e697a7f989ef95c9be544928a61d4650b4ae337 Mon Sep 17 00:00:00 2001 From: kim Date: Mon, 1 Dec 2025 15:43:38 +0100 Subject: [bugfix] don't apply visibility / status filtering when requesting your own account statuses (#4597) # Description This updates our account statuses function to only apply filtering when requesting accounts other than your own. This should prevent confusing situations like https://codeberg.org/superseriousbusiness/gotosocial/issues/4594 occurring. ## Checklist - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [x] I/we have not used so-called 'AI' to create the proposed changes. - [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have performed a self-review of added code. - [x] I/we have written code that is legible and maintainable by others. - [x] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [ ] I/we have added tests that cover new code. - [x] I/we have run tests and they pass locally with the changes. - [x] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4597 Co-authored-by: kim Co-committed-by: kim --- internal/filter/mutes/status.go | 6 ++++++ internal/filter/status/status.go | 6 ++++++ internal/filter/visibility/status.go | 14 +++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'internal/filter') diff --git a/internal/filter/mutes/status.go b/internal/filter/mutes/status.go index befe07e88..b0cdc3400 100644 --- a/internal/filter/mutes/status.go +++ b/internal/filter/mutes/status.go @@ -165,6 +165,12 @@ func (f *Filter) getStatusMuteDetails( next = inReplyTo } + // If requester is owner of the status, + // don't mark it as muted (hidden) to them. + if requester.ID == status.AccountID { + details.mute = false + } + return details, nil } diff --git a/internal/filter/status/status.go b/internal/filter/status/status.go index 572f669d5..d2d18fa21 100644 --- a/internal/filter/status/status.go +++ b/internal/filter/status/status.go @@ -160,6 +160,12 @@ func (f *Filter) getStatusFilterResults( return results, nil } + // Shortcut to check up-front for owner + // of their own status, i.e. no filtering. + if status.AccountID == requester.ID { + return results, nil + } + // Check if status is boost. if status.BoostOfID != "" { if status.BoostOf == nil { diff --git a/internal/filter/visibility/status.go b/internal/filter/visibility/status.go index c46fd369c..f5c236437 100644 --- a/internal/filter/visibility/status.go +++ b/internal/filter/visibility/status.go @@ -96,6 +96,11 @@ func (f *Filter) isStatusVisible( return false, gtserror.Newf("error populating status %s: %w", status.ID, err) } + // Shortcut to check up-front for owner of their own status. + if requester != nil && status.AccountID == requester.ID { + return true, nil + } + // Check whether status accounts are visible to the requester. acctsVisible, err := f.areStatusAccountsVisible(ctx, requester, status) if err != nil { @@ -113,8 +118,8 @@ func (f *Filter) isStatusVisible( } if requester == nil { - // Use a different visibility - // heuristic for unauthed requests. + // Use different visibility heuristics + // when dealing with unauthed requests. return f.isStatusVisibleUnauthed(status), nil } @@ -140,11 +145,6 @@ func (f *Filter) isStatusVisible( is of visibility followers-only or below. */ - if requester.ID == status.AccountID { - // Author can always see their own status. - return true, nil - } - if status.MentionsAccount(requester.ID) { // Status mentions the requesting account. return true, nil -- cgit v1.3