Added checks to suspension to for pro, verified, donor, investor accounts

• Added:
- checks to suspension to for pro, verified, donor, investor accounts
This commit is contained in:
mgabdev 2021-01-23 01:41:35 -05:00
parent 1e5d12497c
commit 3719a6cfd7
3 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,7 @@ class AccountPolicy < ApplicationPolicy
end
def suspend?
staff? && !record.user&.staff?
staff? && !record.user&.staff? && !record.is_pro? && !record.is_investor? && !record.is_donor? && !record.is_verified?
end
def unsuspend?

View File

@ -45,6 +45,7 @@ class SuspendAccountService < BaseService
# @option [Boolean] :destroy Remove the account record instead of suspending
def call(account, **options)
@account = account
return true if @account.is_pro? || @account.is_verified? || @account.is_donor? || @account.is_investor?
@options = options
purge_user!

View File

@ -11,7 +11,8 @@
= link_to t('admin.accounts.warn'), new_admin_account_action_path(@report.target_account_id, type: 'none', report_id: @report.id), class: 'button'
= link_to t('admin.accounts.disable'), new_admin_account_action_path(@report.target_account_id, type: 'disable', report_id: @report.id), class: 'button button--destructive'
= link_to t('admin.accounts.silence'), new_admin_account_action_path(@report.target_account_id, type: 'silence', report_id: @report.id), class: 'button button--destructive'
= link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@report.target_account_id, type: 'suspend', report_id: @report.id), class: 'button button--destructive'
- if !@report.target_account.is_pro? && !@report.target_account.is_investor? && !@report.target_account.is_donor? && !@report.target_account.is_verified?
= link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@report.target_account_id, type: 'suspend', report_id: @report.id), class: 'button button--destructive'
%div{ style: 'float: left' }
= link_to t('admin.reports.mark_as_resolved'), resolve_admin_report_path(@report), method: :post, class: 'button'
- else