mirror of https://github.com/Siphonay/mastodon
Refactor followers_accounts_controller
This commit is contained in:
parent
c2b1e8bc43
commit
0cd367e295
|
@ -36,22 +36,22 @@ class FollowerAccountsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
|
options = { type: :ordered }
|
||||||
|
options[:size] = @account.followers_count
|
||||||
if params[:page].present?
|
if params[:page].present?
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_followers_url(@account, page: params.fetch(:page, 1)),
|
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) },
|
items: follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) },
|
||||||
part_of: account_followers_url(@account),
|
part_of: account_followers_url(@account),
|
||||||
next: page_url(follows.next_page),
|
next: page_url(follows.next_page),
|
||||||
prev: page_url(follows.prev_page)
|
prev: page_url(follows.prev_page),
|
||||||
|
**options
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: account_followers_url(@account),
|
id: account_followers_url(@account),
|
||||||
type: :ordered,
|
first: page_url(1),
|
||||||
size: @account.followers_count,
|
**options
|
||||||
first: page_url(1)
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue