diff options
-rw-r--r-- | app/controllers/api/v1/timelines/public_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/api/v1/timelines/tag_controller.rb | 6 |
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 |