You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
811 B

  1. # frozen_string_literal: true
  2. class FollowingAccountsController < ApplicationController
  3. include AccountControllerConcern
  4. def index
  5. @follows = Follow.where(account: @account).recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:target_account)
  6. respond_to do |format|
  7. format.html
  8. format.json do
  9. render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
  10. end
  11. end
  12. end
  13. private
  14. def collection_presenter
  15. ActivityPub::CollectionPresenter.new(
  16. id: account_following_index_url(@account),
  17. type: :ordered,
  18. size: @account.following_count,
  19. items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) }
  20. )
  21. end
  22. end