about summary refs log tree commit diff
path: root/app/validators
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-01-26 14:01:30 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-01-26 14:01:30 +0100
commitb81710c02c9d8f27d417aa11b288a5b4e32bd5d5 (patch)
tree2f5ba10c2eb3c667dab2dfdb77c3d1724677ce87 /app/validators
parentd1255ab8a5101bc04af4a5214f975edf443a37d9 (diff)
parent7f1c56954b46b26b4dadfa92047f1ee5d7f9ad0a (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `CONTRIBUTING.md`:
  Not a real conflict, glitch-soc quotes the upstream file, which has been
  changed. Update the quote.
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/blacklisted_email_validator.rb2
-rw-r--r--app/validators/html_validator.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/validators/blacklisted_email_validator.rb b/app/validators/blacklisted_email_validator.rb
index 16e3abf12..20a1587cc 100644
--- a/app/validators/blacklisted_email_validator.rb
+++ b/app/validators/blacklisted_email_validator.rb
@@ -22,7 +22,7 @@ class BlacklistedEmailValidator < ActiveModel::Validator
     domains = Rails.configuration.x.email_domains_blacklist.gsub('.', '\.')
     regexp  = Regexp.new("@(.+\\.)?(#{domains})", true)
 
-    @email =~ regexp
+    regexp.match?(@email)
   end
 
   def not_on_whitelist?
diff --git a/app/validators/html_validator.rb b/app/validators/html_validator.rb
index 1c9cd303c..b85b9769f 100644
--- a/app/validators/html_validator.rb
+++ b/app/validators/html_validator.rb
@@ -15,6 +15,6 @@ class HtmlValidator < ActiveModel::EachValidator
 
   def html_errors(str)
     fragment = Nokogiri::HTML.fragment(options[:wrap_with] ? "<#{options[:wrap_with]}>#{str}</#{options[:wrap_with]}>" : str)
-    fragment.errors.select { |error| ERROR_RE =~ error.message }
+    fragment.errors.select { |error| ERROR_RE.match?(error.message) }
   end
 end