fix user lookup by email in disqus import script

This commit is contained in:
Gerhard Schlager
2017-11-16 16:26:18 +01:00
parent 678e28794a
commit 94ceb06b02
2 changed files with 7 additions and 3 deletions

View File

@ -269,7 +269,7 @@ class ImportScripts::Base
merge = opts.delete(:merge)
post_create_action = opts.delete(:post_create_action)
existing = User.joins(:user_emails).where("user_emails.email = ? OR username = ?", opts[:email].downcase, opts[:username]).first
existing = find_existing_user(opts[:email], opts[:username])
return existing if existing && (merge || existing.custom_fields["import_id"].to_s == import_id.to_s)
bio_raw = opts.delete(:bio_raw)
@ -369,6 +369,10 @@ class ImportScripts::Base
u # If there was an error creating the user, u.errors has the messages
end
def find_existing_user(email, username)
User.joins(:user_emails).where("user_emails.email = ? OR username = ?", email.downcase, username).first
end
def created_category(category)
# override if needed
end