diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-07-09 03:27:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 03:27:35 +0200 |
commit | 4e921832272425352d28cad550bfc4dffd6d0e78 (patch) | |
tree | c315a0b9dda8b69b6512c79711e896a18756f701 /app/helpers | |
parent | 1e7187f2a8e0b9ffe4e7d6b06e9f70674c50471e (diff) |
Refactor domain block checks (#11268)
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/domain_control_helper.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/domain_control_helper.rb b/app/helpers/domain_control_helper.rb new file mode 100644 index 000000000..efd328f81 --- /dev/null +++ b/app/helpers/domain_control_helper.rb @@ -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 |