1 # frozen_string_literal: true
3 class FollowerAccountsController
< ApplicationController
4 include AccountControllerConcern
7 @follows = Follow
.where(target_account
: @account).recent
.page(params
[:page]).per(FOLLOW_PER_PAGE
).preload(:account)
13 render json
: collection_presenter
, serializer
: ActivityPub
::CollectionSerializer, adapter
: ActivityPub
::Adapter, content_type
: 'application/activity+json
'
21 account_followers_url(@account, page: page) unless page.nil?
24 def collection_presenter
25 page = ActivityPub::CollectionPresenter.new(
26 id: account_followers_url(@account, page: params.fetch(:page, 1)),
28 size: @account.followers_count,
29 items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) },
30 part_of: account_followers_url(@account),
31 next: page_url(@follows.next_page),
32 prev: page_url(@follows.prev_page)
34 if params[:page].present?
37 ActivityPub::CollectionPresenter.new(
38 id: account_followers_url(@account),
40 size: @account.followers_count,