mirror of
https://github.com/discourse/discourse.git
synced 2025-04-16 21:39:03 +08:00
Use an invalid domain for fake email addresses in importers
This commit is contained in:
parent
d3ba338144
commit
c70d0c6659
@ -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"])),
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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}"
|
||||||
|
@ -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|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user