Skip to content

Commit

Permalink
Fix unfiltered params error when generating ActivityPub tag pagination (
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and multiple creatures committed Feb 21, 2020
1 parent 818075c commit 03953a0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/controllers/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show
format.rss do
expires_in 0, public: true

@statuses = HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none)).limit(PAGE_SIZE)
@statuses = HashtagQueryService.new.call(@tag, filter_params).limit(PAGE_SIZE)
@statuses = cache_collection(@statuses, Status)

render xml: RSS::TagSerializer.render(@tag, @statuses)
Expand All @@ -36,7 +36,7 @@ def show
format.json do
expires_in 3.minutes, public: public_fetch_mode?

@statuses = HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, params[:local]).paginate_by_max_id(PAGE_SIZE, params[:max_id])
@statuses = HashtagQueryService.new.call(@tag, filter_params, current_account, params[:local]).paginate_by_max_id(PAGE_SIZE, params[:max_id])
@statuses = cache_collection(@statuses, Status)

render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
Expand All @@ -60,10 +60,14 @@ def set_instance_presenter

def collection_presenter
ActivityPub::CollectionPresenter.new(
id: tag_url(@tag, params.slice(:any, :all, :none)),
id: tag_url(@tag, filter_params),
type: :ordered,
size: @tag.statuses.count,
items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
)
end

def filter_params
params.slice(:any, :all, :none).permit(:any, :all, :none)
end
end

0 comments on commit 03953a0

Please sign in to comment.