familiar_followers_controller.rb 698 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::FamiliarFollowersController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read, :'read:follows' }
  4. before_action :require_user!
  5. before_action :set_accounts
  6. def index
  7. render json: familiar_followers.accounts, each_serializer: REST::FamiliarFollowersSerializer
  8. end
  9. private
  10. def set_accounts
  11. @accounts = Account.without_suspended.where(id: account_ids).select('id, hide_collections').index_by(&:id).values_at(*account_ids).compact
  12. end
  13. def familiar_followers
  14. FamiliarFollowersPresenter.new(@accounts, current_user.account_id)
  15. end
  16. def account_ids
  17. Array(params[:id]).map(&:to_i)
  18. end
  19. end