mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 01:41:08 +00:00
Extract existing_domain_block private method
This commit is contained in:
parent
523e7ee2cd
commit
3b087708a7
|
@ -41,7 +41,6 @@ module Admin
|
|||
|
||||
def create
|
||||
@domain_block = DomainBlock.new(resource_params)
|
||||
existing_domain_block = resource_params[:domain].present? ? DomainBlock.rule_for(resource_params[:domain]) : nil
|
||||
|
||||
# Disallow accidentally downgrading a domain block
|
||||
if existing_domain_block.present? && !@domain_block.stricter_than?(existing_domain_block)
|
||||
|
@ -99,6 +98,10 @@ module Admin
|
|||
authorize :domain_block, :create?
|
||||
end
|
||||
|
||||
def existing_domain_block
|
||||
@existing_domain_block ||= DomainBlock.rule_for(resource_params[:domain]) if resource_params[:domain].present?
|
||||
end
|
||||
|
||||
def set_domain_block
|
||||
@domain_block = DomainBlock.find(params[:id])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user