闭社主体 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.

24 lines
846 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. @following = Account.following_map(account_ids, current_user.account_id)
  9. @followed_by = Account.followed_by_map(account_ids, current_user.account_id)
  10. @blocking = Account.blocking_map(account_ids, current_user.account_id)
  11. @muting = Account.muting_map(account_ids, current_user.account_id)
  12. @requested = Account.requested_map(account_ids, current_user.account_id)
  13. @domain_blocking = Account.domain_blocking_map(account_ids, current_user.account_id)
  14. end
  15. private
  16. def account_ids
  17. @_account_ids ||= Array(params[:id]).map(&:to_i)
  18. end
  19. end