REFACTOR: more 'fake_email' to base importer
This commit is contained in:
parent
ce0a51665e
commit
afa22a0c6f
|
@ -253,7 +253,7 @@ class ImportScripts::Base
|
|||
|
||||
if user_id_from_imported_user_id(import_id)
|
||||
skipped += 1
|
||||
elsif u[:email].present?
|
||||
else
|
||||
new_user = create_user(u, import_id)
|
||||
created_user(new_user)
|
||||
|
||||
|
@ -270,9 +270,6 @@ class ImportScripts::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
failed += 1
|
||||
puts "Skipping user id #{import_id} because email is blank"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -314,8 +311,8 @@ class ImportScripts::Base
|
|||
opts[:username] = UserNameSuggester.suggest(opts[:username] || opts[:name].presence || opts[:email])
|
||||
end
|
||||
|
||||
unless opts[:email].match(EmailValidator.email_regex)
|
||||
opts[:email] = "invalid#{SecureRandom.hex}@no-email.invalid"
|
||||
unless opts[:email][EmailValidator.email_regex]
|
||||
opts[:email] = fake_email
|
||||
puts "Invalid email #{original_email} for #{opts[:username]}. Using: #{opts[:email]}"
|
||||
end
|
||||
|
||||
|
@ -881,4 +878,8 @@ class ImportScripts::Base
|
|||
offset += batch_size
|
||||
end
|
||||
end
|
||||
|
||||
def fake_email
|
||||
SecureRandom.hex << "@domain.com"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1032,10 +1032,6 @@ SQL
|
|||
html
|
||||
end
|
||||
|
||||
def fake_email
|
||||
SecureRandom.hex << "@domain.com"
|
||||
end
|
||||
|
||||
def mysql_query(sql)
|
||||
@client.query(sql, cache_rows: true)
|
||||
end
|
||||
|
|
|
@ -518,10 +518,6 @@ class ImportScripts::NodeBB < ImportScripts::Base
|
|||
|
||||
raw
|
||||
end
|
||||
|
||||
def fake_email
|
||||
SecureRandom.hex << "@domain.com"
|
||||
end
|
||||
end
|
||||
|
||||
ImportScripts::NodeBB.new.perform
|
||||
|
|
|
@ -551,10 +551,6 @@ EOM
|
|||
Time.zone.at(@tz.utc_to_local(timestamp))
|
||||
end
|
||||
|
||||
def fake_email
|
||||
SecureRandom.hex << "@domain.com"
|
||||
end
|
||||
|
||||
def mysql_query(sql)
|
||||
@client.query(sql, cache_rows: true)
|
||||
end
|
||||
|
|
|
@ -931,10 +931,6 @@ EOM
|
|||
Time.zone.at(@tz.utc_to_local(timestamp))
|
||||
end
|
||||
|
||||
def fake_email
|
||||
SecureRandom.hex << "@domain.com"
|
||||
end
|
||||
|
||||
def mysql_query(sql)
|
||||
@client.query(sql, cache_rows: true)
|
||||
end
|
||||
|
|
|
@ -621,10 +621,6 @@ class ImportScripts::VBulletin < ImportScripts::Base
|
|||
Time.zone.at(@tz.utc_to_local(timestamp))
|
||||
end
|
||||
|
||||
def fake_email
|
||||
SecureRandom.hex << "@domain.com"
|
||||
end
|
||||
|
||||
def mysql_query(sql)
|
||||
@client.query(sql, cache_rows: false)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue