diff --git a/backend/plugins/org/e2e/raw_tables/accounts.csv b/backend/plugins/org/e2e/raw_tables/accounts.csv index 9b1f09eb84e..fced94010b6 100644 --- a/backend/plugins/org/e2e/raw_tables/accounts.csv +++ b/backend/plugins/org/e2e/raw_tables/accounts.csv @@ -2,6 +2,7 @@ "a1","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","e1","","n1","n1","","2022-07-10 14:27:43.813",0 "a10","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","e15","","pq","n10","","2022-07-10 14:27:43.813",0 "a11","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","E6","","zz","zz","","2022-07-10 14:27:43.813",0 +"a12","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","","","","N7","","2022-07-10 14:27:43.813",0 "a2","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","e1","","n2","n2","","2022-07-10 14:27:43.813",0 "a3","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","e2","","xyz","n3","","2022-07-10 14:27:43.813",0 "a4","2022-07-10 14:27:43.813","2022-07-10 14:27:43.813","","",0,"","e4","","n4","n4","","2022-07-10 14:27:43.813",0 diff --git a/backend/plugins/org/e2e/snapshot_tables/user_accounts.csv b/backend/plugins/org/e2e/snapshot_tables/user_accounts.csv index 1e66cceb992..08c28000f38 100644 --- a/backend/plugins/org/e2e/snapshot_tables/user_accounts.csv +++ b/backend/plugins/org/e2e/snapshot_tables/user_accounts.csv @@ -2,6 +2,7 @@ account_id,user_id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remar a1,U111,,,, a10,U010,,,0, a11,U006,,,0, +a12,U007,,,0, a2,U112,,,, a3,U113,,,, a4,U004,,,0, diff --git a/backend/plugins/org/tasks/user_account.go b/backend/plugins/org/tasks/user_account.go index 30cd37b76a7..c8ea94deae8 100644 --- a/backend/plugins/org/tasks/user_account.go +++ b/backend/plugins/org/tasks/user_account.go @@ -43,9 +43,10 @@ func ConnectUserAccountsExact(taskCtx plugin.SubTaskContext) errors.Error { if err != nil { return err } - // Email addresses are compared case-insensitively: a corporate git config and a provider - // profile routinely record the same address with different capitalisation, and matching them - // exactly silently drops links that should be made. + // Email addresses, display names and provider logins are all compared case-insensitively: a + // corporate git config and a provider profile routinely record the same address or name with + // different capitalisation, and provider logins are themselves case-insensitive, so matching + // them exactly silently drops links that should be made. emails := make(map[string]string) names := make(map[string]string) for _, user := range users { @@ -53,7 +54,7 @@ func ConnectUserAccountsExact(taskCtx plugin.SubTaskContext) errors.Error { emails[strings.ToLower(user.Email)] = user.Id } if user.Name != "" { - names[user.Name] = user.Id + names[strings.ToLower(user.Name)] = user.Id } } clauses := []dal.Clause{ @@ -88,7 +89,7 @@ func ConnectUserAccountsExact(taskCtx plugin.SubTaskContext) errors.Error { }, }, nil } - if userId, ok := names[account.FullName]; account.FullName != "" && ok { + if userId, ok := names[strings.ToLower(account.FullName)]; account.FullName != "" && ok { return []interface{}{ &crossdomain.UserAccount{ UserId: userId, @@ -96,7 +97,7 @@ func ConnectUserAccountsExact(taskCtx plugin.SubTaskContext) errors.Error { }, }, nil } - if userId, ok := names[account.UserName]; account.UserName != "" && ok { + if userId, ok := names[strings.ToLower(account.UserName)]; account.UserName != "" && ok { return []interface{}{ &crossdomain.UserAccount{ UserId: userId,