add repo to teams with access to all repositories when changing repo owner
This commit is contained in:
parent
f6983856de
commit
04965880f6
1 changed files with 9 additions and 5 deletions
|
@ -1549,11 +1549,15 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
|
||||||
}
|
}
|
||||||
|
|
||||||
if newOwner.IsOrganization() {
|
if newOwner.IsOrganization() {
|
||||||
t, err := newOwner.getOwnerTeam(sess)
|
if err := newOwner.GetTeams(); err != nil {
|
||||||
if err != nil {
|
return fmt.Errorf("GetTeams: %v", err)
|
||||||
return fmt.Errorf("getOwnerTeam: %v", err)
|
}
|
||||||
} else if err = t.addRepository(sess, repo); err != nil {
|
for _, t := range newOwner.Teams {
|
||||||
return fmt.Errorf("add to owner team: %v", err)
|
if t.IncludesAllRepositories {
|
||||||
|
if err := t.addRepository(sess, repo); err != nil {
|
||||||
|
return fmt.Errorf("addRepository: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Organization called this in addRepository method.
|
// Organization called this in addRepository method.
|
||||||
|
|
Loading…
Reference in a new issue