Extract by_domain_length
scope in DomainNormalizable
concern (#29517)
This commit is contained in:
parent
5b60d4b696
commit
d4ed7e466c
4 changed files with 15 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue