aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_transfer.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo_transfer.go')
-rw-r--r--models/repo_transfer.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/models/repo_transfer.go b/models/repo_transfer.go
index 082c3d19dc..7b766ff4c7 100644
--- a/models/repo_transfer.go
+++ b/models/repo_transfer.go
@@ -299,16 +299,17 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) (err e
// Remove old team-repository relations.
if oldOwner.IsOrganization() {
- if err := oldOwner.removeOrgRepo(sess, repo.ID); err != nil {
+ if err := OrgFromUser(oldOwner).removeOrgRepo(sess, repo.ID); err != nil {
return fmt.Errorf("removeOrgRepo: %v", err)
}
}
if newOwner.IsOrganization() {
- if err := newOwner.loadTeams(sess); err != nil {
+ teams, err := OrgFromUser(newOwner).loadTeams(sess)
+ if err != nil {
return fmt.Errorf("LoadTeams: %v", err)
}
- for _, t := range newOwner.Teams {
+ for _, t := range teams {
if t.IncludesAllRepositories {
if err := t.addRepository(sess, repo); err != nil {
return fmt.Errorf("addRepository: %v", err)