Use lowercased email addresses to check duplicates
This commit is contained in:
parent
ac44374a59
commit
2a0f409b9d
|
@ -128,7 +128,7 @@ class ImportScripts::Lithium < ImportScripts::Base
|
|||
ORDER BY user_id
|
||||
SQL
|
||||
|
||||
duplicate_emails = mysql_query("SELECT email FROM users GROUP BY email HAVING COUNT(email) > 1").map { |e| [e["email"], 0] }.to_h
|
||||
duplicate_emails = mysql_query("SELECT email_lower FROM users GROUP BY email_lower HAVING COUNT(email_lower) > 1").map { |e| [e["email_lower"], 0] }.to_h
|
||||
|
||||
create_users(users, total: user_count, offset: offset) do |user|
|
||||
user_id = user["id"]
|
||||
|
@ -139,9 +139,10 @@ class ImportScripts::Lithium < ImportScripts::Base
|
|||
username = USERNAME_MAPPINGS[username] if USERNAME_MAPPINGS[username].present?
|
||||
|
||||
email = user["email"].presence || fake_email
|
||||
if duplicate_emails.key?(email)
|
||||
duplicate_emails[email] += 1
|
||||
email.sub!("@", "+#{duplicate_emails[email]}@")
|
||||
email_lower = email.downcase
|
||||
if duplicate_emails.key?(email_lower)
|
||||
duplicate_emails[email_lower] += 1
|
||||
email.sub!("@", "+#{duplicate_emails[email_lower]}@")
|
||||
end
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue