about summary refs log tree commit diff
path: root/app/presenters
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-08-25 06:15:55 +0200
committerGitHub <noreply@github.com>2022-08-25 06:15:55 +0200
commit4be626734dfe5d5bb550b117d966aa3f93d0ef38 (patch)
treeab558edfd645052e92881137fdd95a66c1e4eb03 /app/presenters
parent5a3d09dc8e30198b4d8d921ef0b1ba0a35fe01d9 (diff)
parent448ed92f76981f40d6faf48ed9d798ee716a04b2 (diff)
Merge pull request #1827 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/filter_result_presenter.rb2
-rw-r--r--app/presenters/status_relationships_presenter.rb7
2 files changed, 2 insertions, 7 deletions
diff --git a/app/presenters/filter_result_presenter.rb b/app/presenters/filter_result_presenter.rb
index 677225f5e..1e9e8f3c1 100644
--- a/app/presenters/filter_result_presenter.rb
+++ b/app/presenters/filter_result_presenter.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 class FilterResultPresenter < ActiveModelSerializers::Model
-  attributes :filter, :keyword_matches
+  attributes :filter, :keyword_matches, :status_matches
 end
diff --git a/app/presenters/status_relationships_presenter.rb b/app/presenters/status_relationships_presenter.rb
index d7ffb1954..be818a2de 100644
--- a/app/presenters/status_relationships_presenter.rb
+++ b/app/presenters/status_relationships_presenter.rb
@@ -33,12 +33,7 @@ class StatusRelationshipsPresenter
     active_filters = CustomFilter.cached_filters_for(current_account_id)
 
     @filters_map = statuses.each_with_object({}) do |status, h|
-      filter_matches = active_filters.filter_map do |filter, rules|
-        next if rules[:keywords].blank?
-
-        match = rules[:keywords].match(status.proper.searchable_text)
-        FilterResultPresenter.new(filter: filter, keyword_matches: [match.to_s]) unless match.nil?
-      end
+      filter_matches = CustomFilter.apply_cached_filters(active_filters, status)
 
       unless filter_matches.empty?
         h[status.id] = filter_matches