Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/plugins/org/e2e/raw_tables/accounts.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"id","created_at","updated_at","_raw_data_params","_raw_data_table","_raw_data_id","_raw_data_remark","email","avatar_url","full_name","user_name","organization","created_date","status"
"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
"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
Expand Down
1 change: 1 addition & 0 deletions backend/plugins/org/e2e/snapshot_tables/user_accounts.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
account_id,user_id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
a1,U111,,,,
a10,U010,,,0,
a11,U006,,,0,
a2,U112,,,,
a3,U113,,,,
a4,U004,,,0,
Expand Down
8 changes: 6 additions & 2 deletions backend/plugins/org/tasks/user_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"reflect"
"strings"
)

var ConnectUserAccountsExactMeta = plugin.SubTaskMeta{
Expand All @@ -42,11 +43,14 @@ 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.
emails := make(map[string]string)
names := make(map[string]string)
for _, user := range users {
if user.Email != "" {
emails[user.Email] = user.Id
emails[strings.ToLower(user.Email)] = user.Id
}
if user.Name != "" {
names[user.Name] = user.Id
Expand Down Expand Up @@ -76,7 +80,7 @@ func ConnectUserAccountsExact(taskCtx plugin.SubTaskContext) errors.Error {

Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
account := inputRow.(*crossdomain.Account)
if userId, ok := emails[account.Email]; account.Email != "" && ok {
if userId, ok := emails[strings.ToLower(account.Email)]; account.Email != "" && ok {
return []interface{}{
&crossdomain.UserAccount{
UserId: userId,
Expand Down
Loading