Spec coverage and refactor for the api/v1/accounts controllers (#3451)
This commit is contained in:
parent
de4681b2be
commit
5c63523972
18 changed files with 579 additions and 230 deletions
23
app/controllers/api/v1/accounts/credentials_controller.rb
Normal file
23
app/controllers/api/v1/accounts/credentials_controller.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::CredentialsController < ApiController
|
||||
before_action -> { doorkeeper_authorize! :write }, only: [:update]
|
||||
before_action :require_user!
|
||||
|
||||
def show
|
||||
@account = current_account
|
||||
render 'api/v1/accounts/show'
|
||||
end
|
||||
|
||||
def update
|
||||
current_account.update!(account_params)
|
||||
@account = current_account
|
||||
render 'api/v1/accounts/show'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def account_params
|
||||
params.permit(:display_name, :note, :avatar, :header)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue