Import scripts quirk

(Jens Maier) #1

From ImportScripts::Base:

def create_user(opts, import_id)
  existing = User.where(email: opts[:email).downcase, username: opts[:username]).first
  opts[:username] = UserNameSuggester.suggest((opts[:username].present? ? opts[:username] : nil) || opts[:name] || opts[:email])

Since users are always created with sanitized, cleaned usernames via UserNameSuggester, shouldn’t that value be used in the where clause above rather than the original source’s name?

Why is that check even there when @existing_users should already contain all previously imported users?

Edit: Also, opts[:username] is then stored in custom_fields["import_username"] even though it was previously overwritten… :confounded: Is this intended? 'Cause if so, I don’t get it. :grin:

(Kane York) #2

Seems like something you could fix to me.

(Jens Maier) #3

Sure. Just wanted to know if it was intentional. :wink: