about summary refs log tree commit diff
path: root/app/models/domain_block.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-01-08 22:42:05 +0100
committerEugen Rochko <eugen@zeonfederated.com>2020-01-08 22:42:05 +0100
commit51eb1115035499a47bb03670c03afbd03ce7c5ac (patch)
tree06d01371e28750c502cf39dfdc50ce75a5e93941 /app/models/domain_block.rb
parent345dd93310a6ce830444f6f875204d30c43c5a1e (diff)
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.
Diffstat (limited to 'app/models/domain_block.rb')
-rw-r--r--app/models/domain_block.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb
index 4e865b850..f0a5bd296 100644
--- a/app/models/domain_block.rb
+++ b/app/models/domain_block.rb
@@ -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