mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-31 20:58:43 +00:00
Fix org fetching (#2343)
This commit is contained in:
parent
36bfc92fc8
commit
6f1f0e37ce
1 changed files with 13 additions and 11 deletions
|
@ -534,23 +534,25 @@ func (c *Gitea) Org(ctx context.Context, u *model.User, owner string) (*model.Or
|
|||
return nil, err
|
||||
}
|
||||
|
||||
user, _, err := client.GetUserInfo(owner)
|
||||
if user != nil && err == nil {
|
||||
return &model.Org{
|
||||
Name: user.UserName,
|
||||
IsUser: true,
|
||||
Private: user.Visibility != gitea.VisibleTypePublic,
|
||||
}, nil
|
||||
}
|
||||
|
||||
org, _, err := client.GetOrg(owner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if org != nil {
|
||||
return &model.Org{
|
||||
Name: org.UserName,
|
||||
Private: gitea.VisibleType(org.Visibility) != gitea.VisibleTypePublic,
|
||||
}, nil
|
||||
}
|
||||
|
||||
user, _, err := client.GetUserInfo(owner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &model.Org{
|
||||
Name: org.UserName,
|
||||
Private: gitea.VisibleType(org.Visibility) != gitea.VisibleTypePublic,
|
||||
Name: user.UserName,
|
||||
IsUser: true,
|
||||
Private: user.Visibility != gitea.VisibleTypePublic,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue