Refactor domain block checks (#11268)
This commit is contained in:
parent
1e7187f2a8
commit
4e92183227
11 changed files with 108 additions and 51 deletions
17
app/helpers/domain_control_helper.rb
Normal file
17
app/helpers/domain_control_helper.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DomainControlHelper
|
||||
def domain_not_allowed?(uri_or_domain)
|
||||
return if uri_or_domain.blank?
|
||||
|
||||
domain = begin
|
||||
if uri_or_domain.include?('://')
|
||||
Addressable::URI.parse(uri_or_domain).domain
|
||||
else
|
||||
uri_or_domain
|
||||
end
|
||||
end
|
||||
|
||||
DomainBlock.blocked?(domain)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue