summaryrefslogtreecommitdiff
path: root/internal/processing/conversations/get.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-07-04 15:30:39 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-07-04 15:30:39 +0200
commit66e1ec14aa07e115580afc8e1399677f3b54eeda (patch)
tree54aabccf5c0540abbfdea771745f354e05c8eb1a /internal/processing/conversations/get.go
parent[bugfix] set correct scope for StatusFavePOSTHandler (#4310) (diff)
downloadgotosocial-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/get.go')
-rw-r--r--internal/processing/conversations/get.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/internal/processing/conversations/get.go b/internal/processing/conversations/get.go
index 5324466c9..cdc0756c3 100644
--- a/internal/processing/conversations/get.go
+++ b/internal/processing/conversations/get.go
@@ -64,17 +64,26 @@ func (p *Processor) GetAll(
items := make([]interface{}, 0, count)
- filters, errWithCode := p.getFilters(ctx, requestingAccount)
- if errWithCode != nil {
- return nil, errWithCode
- }
-
for _, conversation := range conversations {
+ // Check whether status if filtered by local participant in context.
+ filtered, hide, err := p.statusFilter.StatusFilterResultsInContext(ctx,
+ requestingAccount,
+ conversation.LastStatus,
+ gtsmodel.FilterContextNotifications,
+ )
+ if err != nil {
+ log.Errorf(ctx, "error filtering status: %v", err)
+ continue
+ }
+
+ if hide {
+ continue
+ }
+
// Convert conversation to frontend API model.
apiConversation, err := p.converter.ConversationToAPIConversation(ctx,
conversation,
requestingAccount,
- filters,
)
if err != nil {
log.Errorf(ctx,
@@ -85,6 +94,9 @@ func (p *Processor) GetAll(
continue
}
+ // Set filter results on attached status model.
+ apiConversation.LastStatus.Filtered = filtered
+
// Append conversation to return items.
items = append(items, apiConversation)
}