Use an invalid domain for fake email addresses in importers

This commit is contained in:
Gerhard Schlager 2019-05-30 22:02:10 +02:00
parent d3ba338144
commit c70d0c6659
5 changed files with 5 additions and 5 deletions

View File

@ -118,7 +118,7 @@ class ImportScripts::MyAskBot < ImportScripts::Base
{ {
id: user["id"], id: user["id"],
username: user["username"], username: user["username"],
email: user["email"] || (SecureRandom.hex << "@domain.com"), email: user["email"] || fake_email,
admin: user["is_staff"], admin: user["is_staff"],
created_at: Time.zone.at(@td.decode(user["date_joined"])), created_at: Time.zone.at(@td.decode(user["date_joined"])),
last_seen_at: Time.zone.at(@td.decode(user["last_seen"])), last_seen_at: Time.zone.at(@td.decode(user["last_seen"])),

View File

@ -883,6 +883,6 @@ class ImportScripts::Base
end end
def fake_email def fake_email
SecureRandom.hex << "@domain.com" SecureRandom.hex << "@email.invalid"
end end
end end

View File

@ -139,7 +139,7 @@ class ImportScripts::Bespoke < ImportScripts::Base
# fake it # fake it
if row.email.blank? || row.email !~ /@/ if row.email.blank? || row.email !~ /@/
email = SecureRandom.hex << "@domain.com" email = fake_email
end end
name = row.display_name name = row.display_name

View File

@ -154,7 +154,7 @@ class ImportScripts::Jive < ImportScripts::Base
# fake it # fake it
if row.email.blank? || row.email !~ /@/ if row.email.blank? || row.email !~ /@/
email = SecureRandom.hex << "@domain.com" email = fake_email
end end
name = "#{row.firstname} #{row.lastname}" name = "#{row.firstname} #{row.lastname}"

View File

@ -80,7 +80,7 @@ class ImportScripts::Nabble < ImportScripts::Base
create_users(users, total: total_count, offset: offset) do |row| create_users(users, total: total_count, offset: offset) do |row|
{ {
id: row["user_id"], id: row["user_id"],
email: row["email"] || (SecureRandom.hex << "@domain.com"), email: row["email"] || fake_email,
created_at: Time.zone.at(@td.decode(row["joined"])), created_at: Time.zone.at(@td.decode(row["joined"])),
name: row["name"], name: row["name"],
post_create_action: proc do |user| post_create_action: proc do |user|