mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-14 08:17:29 -06:00
[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>
This commit is contained in:
parent
79914bdbf7
commit
66e1ec14aa
38 changed files with 565 additions and 846 deletions
|
|
@ -96,13 +96,33 @@ func (p *Processor) StatusesGet(
|
|||
return nil, gtserror.NewErrorInternalError(err)
|
||||
}
|
||||
|
||||
for _, s := range filtered {
|
||||
for _, status := range filtered {
|
||||
// ...
|
||||
filtered, hide, err := p.statusFilter.StatusFilterResultsInContext(ctx,
|
||||
requestingAccount,
|
||||
status,
|
||||
gtsmodel.FilterContextAccount,
|
||||
)
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error filtering status: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if hide {
|
||||
// Don't show.
|
||||
continue
|
||||
}
|
||||
|
||||
// Convert filtered statuses to API statuses.
|
||||
item, err := p.converter.StatusToAPIStatus(ctx, s, requestingAccount, gtsmodel.FilterContextAccount)
|
||||
item, err := p.converter.StatusToAPIStatus(ctx, status, requestingAccount)
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error convering to api status: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Set any filter results.
|
||||
item.Filtered = filtered
|
||||
|
||||
items = append(items, item)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue