feat: Account deletion with deleteObjectJob (#6885)

Fixes: https://linear.app/chatwoot/issue/CW-1365/allow-super-admin-to-delete-an-account

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Tejaswini Chile
2023-04-12 13:54:01 +05:30
committed by GitHub
parent 2731c2a5be
commit d45512df72
3 changed files with 34 additions and 2 deletions

View File

@@ -47,4 +47,11 @@ class SuperAdmin::AccountsController < SuperAdmin::ApplicationController
Internal::SeedAccountJob.perform_later(requested_resource)
redirect_back(fallback_location: [namespace, requested_resource], notice: 'Account seeding triggered')
end
def destroy
account = Account.find(params[:id])
DeleteObjectJob.perform_later(account) if account.present?
redirect_back(fallback_location: [namespace, requested_resource], notice: 'Account deletion is in progress.')
end
end