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]) #... end
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?
opts[:username] is then stored in
custom_fields["import_username"] even though it was previously overwritten… Is this intended? 'Cause if so, I don’t get it.