diff options
author | yp05327 | 2023-02-18 21:11:03 +0900 |
---|---|---|
committer | GitHub | 2023-02-18 20:11:03 +0800 |
commit | bd66fa586a0da58c4cf2f5f8390aef4bac9d0527 (patch) | |
tree | 0aa52def7fb8c81ca91a2b882261e9db6a7c174a /services | |
parent | 007d181bb51330c4c24e78c2f40a2e49cae45ed9 (diff) |
Rename `repo.GetOwner` to `repo.LoadOwner` (#22967)
Fixes https://github.com/go-gitea/gitea/issues/22963
---------
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Diffstat (limited to 'services')
-rw-r--r-- | services/convert/issue.go | 2 | ||||
-rw-r--r-- | services/convert/repository.go | 2 | ||||
-rw-r--r-- | services/pull/check.go | 4 | ||||
-rw-r--r-- | services/pull/merge.go | 6 | ||||
-rw-r--r-- | services/pull/temp_repo.go | 12 | ||||
-rw-r--r-- | services/repository/review.go | 2 | ||||
-rw-r--r-- | services/repository/transfer.go | 2 |
7 files changed, 15 insertions, 15 deletions
diff --git a/services/convert/issue.go b/services/convert/issue.go index 02f25e6e0..dccf2f372 100644 --- a/services/convert/issue.go +++ b/services/convert/issue.go @@ -32,7 +32,7 @@ func ToAPIIssue(ctx context.Context, issue *issues_model.Issue) *api.Issue { if err := issue.LoadRepo(ctx); err != nil { return &api.Issue{} } - if err := issue.Repo.GetOwner(ctx); err != nil { + if err := issue.Repo.LoadOwner(ctx); err != nil { return &api.Issue{} } diff --git a/services/convert/repository.go b/services/convert/repository.go index 5db68e837..fc965a945 100644 --- a/services/convert/repository.go +++ b/services/convert/repository.go @@ -100,7 +100,7 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, mode perm.Acc hasProjects = true } - if err := repo.GetOwner(ctx); err != nil { + if err := repo.LoadOwner(ctx); err != nil { return nil } diff --git a/services/pull/check.go b/services/pull/check.go index ea5cccbde..310ea2e71 100644 --- a/services/pull/check.go +++ b/services/pull/check.go @@ -261,8 +261,8 @@ func manuallyMerged(ctx context.Context, pr *issues_model.PullRequest) bool { // When the commit author is unknown set the BaseRepo owner as merger if merger == nil { if pr.BaseRepo.Owner == nil { - if err = pr.BaseRepo.GetOwner(ctx); err != nil { - log.Error("%-v BaseRepo.GetOwner: %v", pr, err) + if err = pr.BaseRepo.LoadOwner(ctx); err != nil { + log.Error("%-v BaseRepo.LoadOwner: %v", pr, err) return false } } diff --git a/services/pull/merge.go b/services/pull/merge.go index a3d69df8d..3ac67d91b 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -199,8 +199,8 @@ func Merge(ctx context.Context, pr *issues_model.PullRequest, doer *user_model.U if err := pr.Issue.LoadRepo(hammerCtx); err != nil { log.Error("LoadRepo for issue [%d]: %v", pr.ID, err) } - if err := pr.Issue.Repo.GetOwner(hammerCtx); err != nil { - log.Error("GetOwner for PR [%d]: %v", pr.ID, err) + if err := pr.Issue.Repo.LoadOwner(hammerCtx); err != nil { + log.Error("LoadOwner for PR [%d]: %v", pr.ID, err) } if wasAutoMerged { @@ -573,7 +573,7 @@ func rawMerge(ctx context.Context, pr *issues_model.PullRequest, doer *user_mode } var headUser *user_model.User - err = pr.HeadRepo.GetOwner(ctx) + err = pr.HeadRepo.LoadOwner(ctx) if err != nil { if !user_model.IsErrUserNotExist(err) { log.Error("Can't find user: %d for head repository - %v", pr.HeadRepo.OwnerID, err) diff --git a/services/pull/temp_repo.go b/services/pull/temp_repo.go index d49a15cea..e0d6b4a15 100644 --- a/services/pull/temp_repo.go +++ b/services/pull/temp_repo.go @@ -38,12 +38,12 @@ func createTemporaryRepo(ctx context.Context, pr *issues_model.PullRequest) (str return "", &repo_model.ErrRepoNotExist{ ID: pr.BaseRepoID, } - } else if err := pr.HeadRepo.GetOwner(ctx); err != nil { - log.Error("HeadRepo.GetOwner: %v", err) - return "", fmt.Errorf("HeadRepo.GetOwner: %w", err) - } else if err := pr.BaseRepo.GetOwner(ctx); err != nil { - log.Error("BaseRepo.GetOwner: %v", err) - return "", fmt.Errorf("BaseRepo.GetOwner: %w", err) + } else if err := pr.HeadRepo.LoadOwner(ctx); err != nil { + log.Error("HeadRepo.LoadOwner: %v", err) + return "", fmt.Errorf("HeadRepo.LoadOwner: %w", err) + } else if err := pr.BaseRepo.LoadOwner(ctx); err != nil { + log.Error("BaseRepo.LoadOwner: %v", err) + return "", fmt.Errorf("BaseRepo.LoadOwner: %w", err) } // Clone base repo. diff --git a/services/repository/review.go b/services/repository/review.go index d30d61ee0..6b5f09605 100644 --- a/services/repository/review.go +++ b/services/repository/review.go @@ -12,7 +12,7 @@ import ( // GetReviewerTeams get all teams can be requested to review func GetReviewerTeams(repo *repo_model.Repository) ([]*organization.Team, error) { - if err := repo.GetOwner(db.DefaultContext); err != nil { + if err := repo.LoadOwner(db.DefaultContext); err != nil { return nil, err } if !repo.Owner.IsOrganization() { diff --git a/services/repository/transfer.go b/services/repository/transfer.go index f4afb7e2d..8c167552d 100644 --- a/services/repository/transfer.go +++ b/services/repository/transfer.go @@ -26,7 +26,7 @@ var repoWorkingPool = sync.NewExclusivePool() // TransferOwnership transfers all corresponding setting from old user to new one. func TransferOwnership(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository, teams []*organization.Team) error { - if err := repo.GetOwner(ctx); err != nil { + if err := repo.LoadOwner(ctx); err != nil { return err } for _, team := range teams { |