mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: phase 1 of supporting multiple email addresses
This commit is contained in:

committed by
Guo Xiang Tan

parent
739794f0cb
commit
d0b027d88d
@ -93,7 +93,7 @@ class BulkImport::Base
|
||||
|
||||
puts "Loading users indexes..."
|
||||
@last_user_id = User.unscoped.maximum(:id)
|
||||
@emails = User.unscoped.pluck(:email).to_set
|
||||
@emails = User.unscoped.pluck(:"user_emails.email").to_set
|
||||
@usernames_lower = User.unscoped.pluck(:username_lower).to_set
|
||||
@mapped_usernames = UserCustomField.joins(:user).where(name: "import_username").pluck("user_custom_fields.value", "users.username").to_h
|
||||
|
||||
|
@ -324,7 +324,7 @@ class ImportScripts::Base
|
||||
rescue => e
|
||||
# try based on email
|
||||
if e.try(:record).try(:errors).try(:messages).try(:[], :email).present?
|
||||
if existing = User.find_by(email: opts[:email].downcase)
|
||||
if existing = User.find_by_email(opts[:email].downcase)
|
||||
existing.custom_fields["import_id"] = import_id
|
||||
existing.save!
|
||||
u = existing
|
||||
|
Reference in New Issue
Block a user