diff options
author | 2024-05-06 04:49:08 -0700 | |
---|---|---|
committer | 2024-05-06 12:49:08 +0100 | |
commit | 45f4afe60e29e147e3adfaa4d7b66ca58e22b1de (patch) | |
tree | 85b14b05516274f504c7237540f8c8fb3b9ae68e /internal/processing/status/get.go | |
parent | [chore]: Bump golang.org/x/oauth2 from 0.19.0 to 0.20.0 (#2900) (diff) | |
download | gotosocial-45f4afe60e29e147e3adfaa4d7b66ca58e22b1de.tar.xz |
feature: filters v2 server-side warning/hiding (#2793)
* Remove dead code
* Filter statuses when converting to frontend representation
* status.filtered is an array
* Make matching case-insensitive
* Remove TODOs that don't need to be done now
* Add missing filter check for notification
* lint: rename ErrHideStatus
* APIFilterActionToFilterAction not used yet
* swaggerino docseroni
* Address review comments
* Add apimodel.FilterActionNone
---------
Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/processing/status/get.go')
-rw-r--r-- | internal/processing/status/get.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/processing/status/get.go b/internal/processing/status/get.go index 57fd4005c..c05f3effd 100644 --- a/internal/processing/status/get.go +++ b/internal/processing/status/get.go @@ -23,6 +23,7 @@ import ( "strings" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" + statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/util" @@ -280,7 +281,15 @@ func TopoSort(apiStatuses []*apimodel.Status, targetAccountID string) { // ContextGet returns the context (previous and following posts) from the given status ID. func (p *Processor) ContextGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Context, gtserror.WithCode) { - return p.contextGet(ctx, requestingAccount, targetStatusID, p.converter.StatusToAPIStatus) + filters, err := p.state.DB.GetFiltersForAccountID(ctx, requestingAccount.ID) + if err != nil { + err = gtserror.Newf("couldn't retrieve filters for account %s: %w", requestingAccount.ID, err) + return nil, gtserror.NewErrorInternalError(err) + } + convert := func(ctx context.Context, status *gtsmodel.Status, requestingAccount *gtsmodel.Account) (*apimodel.Status, error) { + return p.converter.StatusToAPIStatus(ctx, status, requestingAccount, statusfilter.FilterContextThread, filters) + } + return p.contextGet(ctx, requestingAccount, targetStatusID, convert) } // WebContextGet is like ContextGet, but is explicitly |