mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-31 03:37:46 +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,24 +534,26 @@ func (c *Gitea) Org(ctx context.Context, u *model.User, owner string) (*model.Or
|
||||||
return nil, err
|
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)
|
org, _, err := client.GetOrg(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if org != nil {
|
||||||
return &model.Org{
|
return &model.Org{
|
||||||
Name: org.UserName,
|
Name: org.UserName,
|
||||||
Private: gitea.VisibleType(org.Visibility) != gitea.VisibleTypePublic,
|
Private: gitea.VisibleType(org.Visibility) != gitea.VisibleTypePublic,
|
||||||
}, nil
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
user, _, err := client.GetUserInfo(owner)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &model.Org{
|
||||||
|
Name: user.UserName,
|
||||||
|
IsUser: true,
|
||||||
|
Private: user.Visibility != gitea.VisibleTypePublic,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function to return the Gitea client with Token
|
// helper function to return the Gitea client with Token
|
||||||
|
|
Loading…
Reference in a new issue