Extract by_domain_length scope in DomainNormalizable concern (#29517)
This commit is contained in:
@@ -56,7 +56,7 @@ class EmailDomainBlock < ApplicationRecord
|
||||
end
|
||||
|
||||
def blocking?(allow_with_approval: false)
|
||||
blocks = EmailDomainBlock.where(domain: domains_with_variants, allow_with_approval: allow_with_approval).order(Arel.sql('char_length(domain) desc'))
|
||||
blocks = EmailDomainBlock.where(domain: domains_with_variants, allow_with_approval: allow_with_approval).by_domain_length
|
||||
blocks.each { |block| block.history.add(@attempt_ip) } if @attempt_ip.present?
|
||||
blocks.any?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user