From 8a486d8cea224938be99353dafeef35006e968a7 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sun, 21 Feb 2016 21:58:47 +0100 Subject: [PATCH] Allow importers to set empty names --- script/import_scripts/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 1ebdaee3683..63c55de5904 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -278,7 +278,6 @@ class ImportScripts::Base avatar_url = opts.delete(:avatar_url) # Allow the || operations to work with empty strings '' - opts[:name] = nil if opts[:name].blank? opts[:username] = nil if opts[:username].blank? opts[:name] = User.suggest_name(opts[:email]) unless opts[:name] @@ -287,7 +286,8 @@ class ImportScripts::Base opts[:username].length > User.username_length.end || !User.username_available?(opts[:username]) || !UsernameValidator.new(opts[:username]).valid_format? - opts[:username] = UserNameSuggester.suggest(opts[:username] || opts[:name] || opts[:email]) + + opts[:username] = UserNameSuggester.suggest(opts[:username] || opts[:name].presence || opts[:email]) end opts[:email] = opts[:email].downcase opts[:trust_level] = TrustLevel[1] unless opts[:trust_level]