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

25 lines
765 B

  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::CredentialsController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read }, except: [:update]
  4. before_action -> { doorkeeper_authorize! :write }, only: [:update]
  5. before_action :require_user!
  6. def show
  7. @account = current_account
  8. render json: @account, serializer: REST::CredentialAccountSerializer
  9. end
  10. def update
  11. @account = current_account
  12. UpdateAccountService.new.call(@account, account_params, raise_error: true)
  13. ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
  14. render json: @account, serializer: REST::CredentialAccountSerializer
  15. end
  16. private
  17. def account_params
  18. params.permit(:display_name, :note, :avatar, :header)
  19. end
  20. end