闭社主体 forked from https://github.com/tootsuite/mastodon
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.

23 lines
581 B

  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::RelationshipsController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read }
  4. before_action :require_user!
  5. respond_to :json
  6. def index
  7. @accounts = Account.where(id: account_ids).select('id')
  8. render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
  9. end
  10. private
  11. def relationships
  12. AccountRelationshipsPresenter.new(@accounts, current_user.account_id)
  13. end
  14. def account_ids
  15. @_account_ids ||= Array(params[:id]).map(&:to_i)
  16. end
  17. end