mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 09:51:24 +00:00
Extract confirmation check to before action
This commit is contained in:
parent
9326490325
commit
0dfa014fba
|
@ -8,6 +8,7 @@ module Admin
|
||||||
before_action :populate_domain_block_from_params
|
before_action :populate_domain_block_from_params
|
||||||
before_action :prevent_downgrade
|
before_action :prevent_downgrade
|
||||||
before_action :attempt_transparent_upgrade, if: :existing_domain_block
|
before_action :attempt_transparent_upgrade, if: :existing_domain_block
|
||||||
|
before_action :verify_confirmation_needed
|
||||||
end
|
end
|
||||||
|
|
||||||
PERMITTED_PARAMS = %i(
|
PERMITTED_PARAMS = %i(
|
||||||
|
@ -44,9 +45,6 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
# Require explicit confirmation when suspending
|
|
||||||
return render :confirm_suspension if requires_confirmation?
|
|
||||||
|
|
||||||
if @domain_block.save
|
if @domain_block.save
|
||||||
DomainBlockWorker.perform_async(@domain_block.id)
|
DomainBlockWorker.perform_async(@domain_block.id)
|
||||||
log_action :create, @domain_block
|
log_action :create, @domain_block
|
||||||
|
@ -108,6 +106,11 @@ module Admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def verify_confirmation_needed
|
||||||
|
# Require explicit confirmation when suspending
|
||||||
|
render :confirm_suspension if requires_confirmation?
|
||||||
|
end
|
||||||
|
|
||||||
def existing_domain_block
|
def existing_domain_block
|
||||||
@existing_domain_block ||= DomainBlock.rule_for(resource_params[:domain]) if resource_params[:domain].present?
|
@existing_domain_block ||= DomainBlock.rule_for(resource_params[:domain]) if resource_params[:domain].present?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user