Importers: What to do when missing email addresses


(Jay Pfaffman) #1

I’m doing a phpBB import. There are a bunch of missing email addresses (apparently because Facebook and others authenticated, but didn’t supply an email address) and a bunch more invalid ones.

The client doesn’t want to have messages from those 12K (of 370K) users all lumped in to @system.

One solution I’m considering is modifying create_users in base.rb to call create_user when the email is missing (not sure why create_users needed to do that anyway, as create_user checks too) and then modifying create_user to use {discourse_username}@badmail.domain.com as the email address (Of course there are invalid usernames too, so I’ll go with the Discourse username).

This will mean that these users exist in the system, but if a user is to reclaim the account it’ll require manual intervention from an admin, which this client seems OK with.

Questions:

  • Is there some better way?
  • Should I submit a PR?
  • How long would such a change take a competent developer?

(Gerhard Schlager) #2

Just generating an email address won’t be enough. You should definitely disable emails for those users as I’m doing for anonymous users. You could either do this in the base importer or just modify the phpBB importer so that it handles users with missing email addresses similar to anonymous users.

BTW: It’s a good idea to use the .invalid TLD for generated email addresses (just in case something goes wrong and Discourse starts to send emails to those users). I’m using the following for anonymous users:

"anonymous_#{SecureRandom.hex}@no-email.invalid"

(Jeff Atwood) #3

Yes what @gerhard said … when we migrated coding horror comments we used this filler email:

francis@no-email-found.com

(where the first name was the first name of the commenter…)