about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-10-05 02:14:21 -0500
committermultiple creatures <dev@multiple-creature.party>2019-10-05 02:14:21 -0500
commitce6a7055159a169ca38162eb2e38825f9331c8d9 (patch)
tree12095e46b9df1c8f33a981930aa22ba5ca90d680
parenta9631d4601c6eef08751122a0ba7897609f3eca8 (diff)
apply custom filters to world and tag timelines the slow way until the custom filter system gets changed
-rw-r--r--app/controllers/api/v1/timelines/public_controller.rb6
-rw-r--r--app/controllers/api/v1/timelines/tag_controller.rb6
2 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb
index 9c3f6c0a8..66079140b 100644
--- a/app/controllers/api/v1/timelines/public_controller.rb
+++ b/app/controllers/api/v1/timelines/public_controller.rb
@@ -1,12 +1,14 @@
 # frozen_string_literal: true
 
 class Api::V1::Timelines::PublicController < Api::BaseController
+  include FilterHelper
+
   after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
 
   respond_to :json
 
   def show
-    @statuses = load_statuses
+    @statuses = current_account ? load_statuses.reject { |status| phrase_filtered?(status, current_account.id, 'public') } : load_statuses
     render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
   end
 
@@ -37,7 +39,7 @@ class Api::V1::Timelines::PublicController < Api::BaseController
   end
 
   def public_timeline_statuses
-    Status.as_public_timeline(current_account, truthy_param?(:local))
+    statuses = Status.as_public_timeline(current_account, truthy_param?(:local))
   end
 
   def insert_pagination_headers
diff --git a/app/controllers/api/v1/timelines/tag_controller.rb b/app/controllers/api/v1/timelines/tag_controller.rb
index 126ffb5dc..f6ca033c7 100644
--- a/app/controllers/api/v1/timelines/tag_controller.rb
+++ b/app/controllers/api/v1/timelines/tag_controller.rb
@@ -1,13 +1,15 @@
 # frozen_string_literal: true
 
 class Api::V1::Timelines::TagController < Api::BaseController
+  include FilterHelper
+
   before_action :load_tag
   after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
 
   respond_to :json
 
   def show
-    @statuses = load_statuses
+    @statuses = current_account ? load_statuses.reject { |status| phrase_filtered?(status, current_account.id, 'public') } : load_statuses
     render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
   end
 
@@ -47,7 +49,7 @@ class Api::V1::Timelines::TagController < Api::BaseController
   end
 
   def tag_timeline_statuses
-    HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, truthy_param?(:local))
+    statuses = HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, truthy_param?(:local))
   end
 
   def bookmark_results