From 45f4afe60e29e147e3adfaa4d7b66ca58e22b1de Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Mon, 6 May 2024 04:49:08 -0700 Subject: 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 --- internal/processing/timeline/home.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/processing/timeline/home.go') diff --git a/internal/processing/timeline/home.go b/internal/processing/timeline/home.go index d12dd98c4..e174b3428 100644 --- a/internal/processing/timeline/home.go +++ b/internal/processing/timeline/home.go @@ -23,6 +23,7 @@ import ( apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/db" + statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status" "github.com/superseriousbusiness/gotosocial/internal/filter/visibility" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" @@ -98,7 +99,13 @@ func HomeTimelineStatusPrepare(state *state.State, converter *typeutils.Converte return nil, err } - return converter.StatusToAPIStatus(ctx, status, requestingAccount) + filters, err := 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, err + } + + return converter.StatusToAPIStatus(ctx, status, requestingAccount, statusfilter.FilterContextHome, filters) } } -- cgit v1.2.3