Allow blocking TLDs, and fix TLD blocks not being editable (#12805)
Fixes #12795 It was already possible to create domain blocks for TLDs, but those weren't enforced, nor editable. This commit changes it so that they are enforced and editable.
This commit is contained in:
@ -54,7 +54,7 @@ class DomainBlock < ApplicationRecord
|
||||
segments = uri.normalized_host.split('.')
|
||||
variants = segments.map.with_index { |_, i| segments[i..-1].join('.') }
|
||||
|
||||
where(domain: variants[0..-2]).order(Arel.sql('char_length(domain) desc')).first
|
||||
where(domain: variants).order(Arel.sql('char_length(domain) desc')).first
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user