diff options
| author | 2025-07-04 15:30:39 +0200 | |
|---|---|---|
| committer | 2025-07-04 15:30:39 +0200 | |
| commit | 66e1ec14aa07e115580afc8e1399677f3b54eeda (patch) | |
| tree | 54aabccf5c0540abbfdea771745f354e05c8eb1a /internal/processing/conversations/read.go | |
| parent | [bugfix] set correct scope for StatusFavePOSTHandler (#4310) (diff) | |
| download | gotosocial-66e1ec14aa07e115580afc8e1399677f3b54eeda.tar.xz | |
[chore] move status filtering from type converter (#4306)
This finalizes the moving status filtering out of the type converter, and into its own `./internal/filter/` subpkg :)
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4306
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/processing/conversations/read.go')
| -rw-r--r-- | internal/processing/conversations/read.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/internal/processing/conversations/read.go b/internal/processing/conversations/read.go index 4d16a4eeb..c7e4f1acd 100644 --- a/internal/processing/conversations/read.go +++ b/internal/processing/conversations/read.go @@ -23,6 +23,7 @@ import ( apimodel "code.superseriousbusiness.org/gotosocial/internal/api/model" "code.superseriousbusiness.org/gotosocial/internal/gtserror" "code.superseriousbusiness.org/gotosocial/internal/gtsmodel" + "code.superseriousbusiness.org/gotosocial/internal/log" "code.superseriousbusiness.org/gotosocial/internal/util" ) @@ -44,20 +45,27 @@ func (p *Processor) Read( return nil, gtserror.NewErrorInternalError(err) } - filters, errWithCode := p.getFilters(ctx, requestingAccount) - if errWithCode != nil { - return nil, errWithCode + // Check whether status if filtered by local participant in context. + filtered, _, err := p.statusFilter.StatusFilterResultsInContext(ctx, + requestingAccount, + conversation.LastStatus, + gtsmodel.FilterContextNotifications, + ) + if err != nil { + log.Errorf(ctx, "error filtering status: %v", err) } apiConversation, err := p.converter.ConversationToAPIConversation(ctx, conversation, requestingAccount, - filters, ) if err != nil { err = gtserror.Newf("error converting conversation %s to API representation: %w", id, err) return nil, gtserror.NewErrorInternalError(err) } + // Set filter results on attached status model. + apiConversation.LastStatus.Filtered = filtered + return apiConversation, nil } |
