Refactor followers_accounts_controller

th-downstream
Thibaut Girka 6 years ago committed by ThibG
parent 450b428536
commit a52a0e021b

@ -36,22 +36,22 @@ class FollowerAccountsController < ApplicationController
end
def collection_presenter
options = { type: :ordered }
options[:size] = @account.followers_count
if params[:page].present?
ActivityPub::CollectionPresenter.new(
id: account_followers_url(@account, page: params.fetch(:page, 1)),
type: :ordered,
size: @account.followers_count,
items: follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) },
part_of: account_followers_url(@account),
next: page_url(follows.next_page),
prev: page_url(follows.prev_page)
prev: page_url(follows.prev_page),
**options
)
else
ActivityPub::CollectionPresenter.new(
id: account_followers_url(@account),
type: :ordered,
size: @account.followers_count,
first: page_url(1)
first: page_url(1),
**options
)
end
end

Loading…
Cancel
Save