Log admin approve and reject account (#22088)

* Log admin approve and reject account

* Add unit tests for approve and reject logging
This commit is contained in:
Francis Murillo
2022-12-06 23:25:18 +00:00
committed by GitHub
parent c8849d6cee
commit f6492a7c4d
4 changed files with 103 additions and 0 deletions

View File

@ -54,12 +54,14 @@ class Api::V1::Admin::AccountsController < Api::BaseController
def approve
authorize @account.user, :approve?
@account.user.approve!
log_action :approve, @account.user
render json: @account, serializer: REST::Admin::AccountSerializer
end
def reject
authorize @account.user, :reject?
DeleteAccountService.new.call(@account, reserve_email: false, reserve_username: false)
log_action :reject, @account.user
render_empty
end