@@ -360,28 +360,33 @@ func (a *Affiliation) GetProfileByUsername(username string, projectSlug string)
360360 return nil , errors .New ("user not found" )
361361 }
362362
363- var profile UniqueIdentityFullProfile
364- err = json .Unmarshal (res , & profile )
363+ var response ProfileByUsernameResponse
364+ err = json .Unmarshal (res , & response )
365365 if err != nil {
366366 return nil , err
367367 }
368+
369+ profile := response .Profile [0 ]
368370 var identity AffIdentity
369371
370372 for _ , value := range profile .Identities {
371373 if value .Source == "github" {
372374 profileIdentity := value
373375 identity .UUID = profileIdentity .UUID
374- if profileIdentity .Name != nil {
375- identity .Name = * profileIdentity .Name
376- } else {
377- identity .Name = unknown
378- }
379-
380376 if profileIdentity .Email != nil {
381377 identity .Email = * profileIdentity .Email
382378 }
383379
384380 identity .ID = & profileIdentity .ID
381+
382+ if profile .Profile != nil {
383+ identity .IsBot = profile .Profile .IsBot
384+ identity .Name = * profile .Profile .Name
385+ } else if profileIdentity .Name != nil {
386+ identity .Name = * profileIdentity .Name
387+ } else {
388+ identity .Name = unknown
389+ }
385390 }
386391 }
387392
@@ -393,10 +398,6 @@ func (a *Affiliation) GetProfileByUsername(username string, projectSlug string)
393398
394399 identity .Username = username
395400
396- if profile .Profile != nil {
397- identity .IsBot = profile .Profile .IsBot
398- }
399-
400401 if profile .Enrollments == nil {
401402 identity .OrgName = & unknown
402403 identity .MultiOrgNames = make ([]string , 0 )
0 commit comments