From 5f40be707b6174da0b6585b8590b83802f77d32d Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Wed, 1 Mar 2017 10:56:17 +0000 Subject: [PATCH] PLT-5479: Import Slack team without emails. Use a fake email address for now, and inform the user doing the import clearly that this has been done. --- app/slackimport.go | 5 +++++ i18n/en.json | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/app/slackimport.go b/app/slackimport.go index e54d0724b0eda..a350eeb8f3c70 100644 --- a/app/slackimport.go +++ b/app/slackimport.go @@ -155,6 +155,11 @@ func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map } email := sUser.Profile["email"] + if email == "" { + email = sUser.Username + "@example.com" + log.WriteString(utils.T("api.slackimport.slack_add_users.missing_email_address", map[string]interface{}{"Email": email, "Username": sUser.Username})) + l4g.Warn(utils.T("api.slackimport.slack_add_users.missing_email_address.warn", map[string]interface{}{"Email": email, "Username": sUser.Username})) + } password := model.NewId() diff --git a/i18n/en.json b/i18n/en.json index d46812bd8c7e9..9a8fff2252c47 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1719,6 +1719,14 @@ "id": "api.slackimport.slack_add_channels.failed_to_add_user", "translation": "Failed to add user to channel: {{.Username}}\r\n" }, + { + "id": "api.slackimport.slack_add_users.missing_email_address", + "translation": "User {{.Username}} does not have an email address in the Slack export. Using {{.Email}} as a placeholder. The user should update their email address once logged in to the system.\r\n" + }, + { + "id": "api.slackimport.slack_add_users.missing_email_address.warn", + "translation": "User {{.Username}} does not have an email address in the Slack export. Using {{.Email}} as a placeholder. The user should update their email address once logged in to the system." + }, { "id": "api.slackimport.slack_add_channels.import_failed", "translation": "Failed to import: {{.DisplayName}}\r\n"