Replace EmailHelper module with normalizes via model concern (#35702)

This commit is contained in:
Matt Jankowski
2025-08-07 09:47:47 -04:00
committed by GitHub
parent 496a5f423e
commit a485f97d21
4 changed files with 47 additions and 25 deletions

View File

@@ -1,18 +0,0 @@
# frozen_string_literal: true
module EmailHelper
def self.included(base)
base.extend(self)
end
def email_to_canonical_email(str)
username, domain = str.downcase.split('@', 2)
username, = username.delete('.').split('+', 2)
"#{username}@#{domain}"
end
def email_to_canonical_email_hash(str)
Digest::SHA2.new(256).hexdigest(email_to_canonical_email(str))
end
end