Class: NewsmastMastodon::Api::V1::AccountsController

Inherits:
Api::BaseController
  • Object
show all
Includes:
Concerns::ApiResponseHelper, Redisable
Defined in:
app/controllers/newsmast_mastodon/api/v1/accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#delete_accountObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/newsmast_mastodon/api/v1/accounts_controller.rb', line 11

def 
  if current_user.valid_password?([:password])
    .suspend!(origin: :local, block_email: false)
    AccountDeletionWorker.perform_async(current_user., { 'reserve_username' => true})
    sign_out
    render_success(data = {}, message_key = 'api.messages.deleted', status = :ok, additional_params = {})
  else
    return render_result({}, 'api.account.errors.password_incorrect', :unprocessable_entity)
  end
end