From 2e85331dd451cae285d3cd3efad78cc6d2e4e60a Mon Sep 17 00:00:00 2001 From: ArtOfCode- <hello@artofcode.co.uk> Date: Thu, 6 Aug 2020 22:51:23 +0100 Subject: [PATCH] Only run email checks if email changed --- app/models/user.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index f80e49436..2f066de15 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -125,6 +125,7 @@ class User < ApplicationRecord def email_domain_not_blocklisted return unless File.exist?(Rails.root.join('../.qpixel-domain-blocklist.txt')) + return unless saved_changes.include? 'email' blocklist = File.read(Rails.root.join('../.qpixel-domain-blocklist.txt')).split("\n") email_domain = email.split('@')[-1] @@ -158,6 +159,7 @@ class User < ApplicationRecord def email_not_bad_pattern return unless File.exist?(Rails.root.join('../.qpixel-email-patterns.txt')) + return unless saved_changes.include? 'email' patterns = File.read(Rails.root.join('../.qpixel-email-patterns.txt')).split("\n") matched = patterns.select { |p| email.match? Regexp.new(p) } -- GitLab