Fix failure to import same Slack archive to 2 teams. (#4650)
This fixes the issue where you can't import 2 Slack exports with any users who's emails appear in both exports onto different teams of the same server. Fixes #4126
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
7315d69474
Коммит
be0ae36422
@@ -162,7 +162,11 @@ func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map
|
|||||||
if result := <-Srv.Store.User().GetByEmail(email); result.Err == nil {
|
if result := <-Srv.Store.User().GetByEmail(email); result.Err == nil {
|
||||||
existingUser := result.Data.(*model.User)
|
existingUser := result.Data.(*model.User)
|
||||||
addedUsers[sUser.Id] = existingUser
|
addedUsers[sUser.Id] = existingUser
|
||||||
|
if err := JoinUserToTeam(team, addedUsers[sUser.Id]); err != nil {
|
||||||
|
log.WriteString(utils.T("api.slackimport.slack_add_users.merge_existing_failed", map[string]interface{}{"Email": existingUser.Email, "Username": existingUser.Username}))
|
||||||
|
} else {
|
||||||
log.WriteString(utils.T("api.slackimport.slack_add_users.merge_existing", map[string]interface{}{"Email": existingUser.Email, "Username": existingUser.Username}))
|
log.WriteString(utils.T("api.slackimport.slack_add_users.merge_existing", map[string]interface{}{"Email": existingUser.Email, "Username": existingUser.Username}))
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1643,6 +1643,10 @@
|
|||||||
"id": "api.slackimport.slack_add_users.merge_existing",
|
"id": "api.slackimport.slack_add_users.merge_existing",
|
||||||
"translation": "Merged user with existing account: {{.Email}}, {{.Username}}\r\n"
|
"translation": "Merged user with existing account: {{.Email}}, {{.Username}}\r\n"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "api.slackimport.slack_add_users.merge_existing_failed",
|
||||||
|
"translation": "Tried to merge user with existing account: {{.Email}}, {{.Username}}, but failed to add the user to this team.\r\n"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.slackimport.slack_add_users.unable_import",
|
"id": "api.slackimport.slack_add_users.unable_import",
|
||||||
"translation": "Unable to import user: {{.Username}}\r\n"
|
"translation": "Unable to import user: {{.Username}}\r\n"
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user