aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_transfer.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-19 19:41:40 +0800
committerGitHub <noreply@github.com>2021-11-19 19:41:40 +0800
commit7a0347315995b25bcb2dca4786504fb699b5f004 (patch)
tree803dfd39286216fd0521ad16539ffd9fc5f87fc0 /models/repo_transfer.go
parenta09b40de8d1dae7107437cfba42cee201fcd6d42 (diff)
downloadgitea-7a0347315995b25bcb2dca4786504fb699b5f004.tar.gz
gitea-7a0347315995b25bcb2dca4786504fb699b5f004.zip
Use a standalone struct name for Organization (#17632)
* Use a standalone struct name for Organization * recover unnecessary change * make the code readable * Fix template failure * Fix template failure * Move HasMemberWithUserID to org * Fix test * Remove unnecessary user type check * Fix test Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
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)