0
0
Fork 0

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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 103 additions and 0 deletions

View file

@ -55,12 +55,14 @@ module Admin
def approve
authorize @account.user, :approve?
@account.user.approve!
log_action :approve, @account.user
redirect_to admin_accounts_path(status: 'pending'), notice: I18n.t('admin.accounts.approved_msg', username: @account.acct)
end
def reject
authorize @account.user, :reject?
DeleteAccountService.new.call(@account, reserve_email: false, reserve_username: false)
log_action :reject, @account.user
redirect_to admin_accounts_path(status: 'pending'), notice: I18n.t('admin.accounts.rejected_msg', username: @account.acct)
end