From bd66fa586a0da58c4cf2f5f8390aef4bac9d0527 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Sat, 18 Feb 2023 21:11:03 +0900 Subject: Rename `repo.GetOwner` to `repo.LoadOwner` (#22967) Fixes https://github.com/go-gitea/gitea/issues/22963 --------- Co-authored-by: Yarden Shoham --- routers/api/v1/repo/repo.go | 2 +- routers/api/v1/user/repo.go | 4 ++-- routers/web/repo/compare.go | 2 +- routers/web/repo/http.go | 4 ++-- routers/web/repo/issue.go | 4 ++-- routers/web/repo/pull.go | 8 ++++---- routers/web/repo/setting.go | 2 +- routers/web/repo/view.go | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) (limited to 'routers') diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index f5db45ffea..0395198e20 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -201,7 +201,7 @@ func Search(ctx *context.APIContext) { results := make([]*api.Repository, len(repos)) for i, repo := range repos { - if err = repo.GetOwner(ctx); err != nil { + if err = repo.LoadOwner(ctx); err != nil { ctx.JSON(http.StatusInternalServerError, api.SearchError{ OK: false, Error: err.Error(), diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go index d566c072fb..dcb14780a7 100644 --- a/routers/api/v1/user/repo.go +++ b/routers/api/v1/user/repo.go @@ -119,8 +119,8 @@ func ListMyRepos(ctx *context.APIContext) { results := make([]*api.Repository, len(repos)) for i, repo := range repos { - if err = repo.GetOwner(ctx); err != nil { - ctx.Error(http.StatusInternalServerError, "GetOwner", err) + if err = repo.LoadOwner(ctx); err != nil { + ctx.Error(http.StatusInternalServerError, "LoadOwner", err) return } accessMode, err := access_model.AccessLevel(ctx, ctx.Doer, repo) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 5b6faf4d83..4e40867de2 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -279,7 +279,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { } return nil } - if err := ci.HeadRepo.GetOwner(ctx); err != nil { + if err := ci.HeadRepo.LoadOwner(ctx); err != nil { if user_model.IsErrUserNotExist(err) { ctx.NotFound("GetUserByName", nil) } else { diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index e82b94b9e8..9d4ffccc6d 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -146,8 +146,8 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { // don't allow anonymous pulls if organization is not public if isPublicPull { - if err := repo.GetOwner(ctx); err != nil { - ctx.ServerError("GetOwner", err) + if err := repo.LoadOwner(ctx); err != nil { + ctx.ServerError("LoadOwner", err) return } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 42dcfb382d..62565af50f 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -2157,8 +2157,8 @@ func UpdatePullReviewRequest(ctx *context.Context) { } if reviewID < 0 { // negative reviewIDs represent team requests - if err := issue.Repo.GetOwner(ctx); err != nil { - ctx.ServerError("issue.Repo.GetOwner", err) + if err := issue.Repo.LoadOwner(ctx); err != nil { + ctx.ServerError("issue.Repo.LoadOwner", err) return } diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index ad17005d90..c7a59da8a8 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -119,8 +119,8 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository { return nil } - if err := forkRepo.GetOwner(ctx); err != nil { - ctx.ServerError("GetOwner", err) + if err := forkRepo.LoadOwner(ctx); err != nil { + ctx.ServerError("LoadOwner", err) return nil } @@ -1315,8 +1315,8 @@ func CleanUpPullRequest(ctx *context.Context) { } else if err = pr.LoadBaseRepo(ctx); err != nil { ctx.ServerError("LoadBaseRepo", err) return - } else if err = pr.HeadRepo.GetOwner(ctx); err != nil { - ctx.ServerError("HeadRepo.GetOwner", err) + } else if err = pr.HeadRepo.LoadOwner(ctx); err != nil { + ctx.ServerError("HeadRepo.LoadOwner", err) return } diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index 436438c436..387a917412 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -650,7 +650,7 @@ func SettingsPost(ctx *context.Context) { ctx.Error(http.StatusNotFound) return } - if err := repo.GetOwner(ctx); err != nil { + if err := repo.LoadOwner(ctx); err != nil { ctx.ServerError("Convert Fork", err) return } diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 99043e3ee7..e3c61fa408 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -1033,8 +1033,8 @@ func Forks(ctx *context.Context) { } for _, fork := range forks { - if err = fork.GetOwner(ctx); err != nil { - ctx.ServerError("GetOwner", err) + if err = fork.LoadOwner(ctx); err != nil { + ctx.ServerError("LoadOwner", err) return } } -- cgit v1.2.3