aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authoryp053272023-02-18 21:11:03 +0900
committerGitHub2023-02-18 20:11:03 +0800
commitbd66fa586a0da58c4cf2f5f8390aef4bac9d0527 (patch)
tree0aa52def7fb8c81ca91a2b882261e9db6a7c174a /modules
parent007d181bb51330c4c24e78c2f40a2e49cae45ed9 (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 'modules')
-rw-r--r--modules/context/repo.go12
-rw-r--r--modules/doctor/misc.go2
-rw-r--r--modules/repository/collaborator_test.go2
-rw-r--r--modules/repository/create.go6
-rw-r--r--modules/repository/delete.go2
-rw-r--r--modules/test/context_tests.go2
6 files changed, 13 insertions, 13 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index a38376ff4..e4ac65e96 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -273,8 +273,8 @@ func RetrieveBaseRepo(ctx *Context, repo *repo_model.Repository) {
}
ctx.ServerError("GetBaseRepo", err)
return
- } else if err = repo.BaseRepo.GetOwner(ctx); err != nil {
- ctx.ServerError("BaseRepo.GetOwner", err)
+ } else if err = repo.BaseRepo.LoadOwner(ctx); err != nil {
+ ctx.ServerError("BaseRepo.LoadOwner", err)
return
}
}
@@ -290,8 +290,8 @@ func RetrieveTemplateRepo(ctx *Context, repo *repo_model.Repository) {
}
ctx.ServerError("GetTemplateRepo", err)
return
- } else if err = templateRepo.GetOwner(ctx); err != nil {
- ctx.ServerError("TemplateRepo.GetOwner", err)
+ } else if err = templateRepo.LoadOwner(ctx); err != nil {
+ ctx.ServerError("TemplateRepo.LoadOwner", err)
return
}
@@ -356,8 +356,8 @@ func RedirectToRepo(ctx *Context, redirectRepoID int64) {
func repoAssignment(ctx *Context, repo *repo_model.Repository) {
var err error
- 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/modules/doctor/misc.go b/modules/doctor/misc.go
index 73df51390..f20b5b26d 100644
--- a/modules/doctor/misc.go
+++ b/modules/doctor/misc.go
@@ -141,7 +141,7 @@ func checkDaemonExport(ctx context.Context, logger log.Logger, autofix bool) err
if owner, has := cache.Get(repo.OwnerID); has {
repo.Owner = owner.(*user_model.User)
} else {
- if err := repo.GetOwner(ctx); err != nil {
+ if err := repo.LoadOwner(ctx); err != nil {
return err
}
cache.Add(repo.OwnerID, repo.Owner)
diff --git a/modules/repository/collaborator_test.go b/modules/repository/collaborator_test.go
index 6cf239d0e..c77280681 100644
--- a/modules/repository/collaborator_test.go
+++ b/modules/repository/collaborator_test.go
@@ -23,7 +23,7 @@ func TestRepository_AddCollaborator(t *testing.T) {
testSuccess := func(repoID, userID int64) {
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: repoID})
- assert.NoError(t, repo.GetOwner(db.DefaultContext))
+ assert.NoError(t, repo.LoadOwner(db.DefaultContext))
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: userID})
assert.NoError(t, AddCollaborator(db.DefaultContext, repo, user))
unittest.CheckConsistencyFor(t, &repo_model.Repository{ID: repoID}, &user_model.User{ID: userID})
diff --git a/modules/repository/create.go b/modules/repository/create.go
index b9a72ad57..1704ea792 100644
--- a/modules/repository/create.go
+++ b/modules/repository/create.go
@@ -335,7 +335,7 @@ func UpdateRepoSize(ctx context.Context, repo *repo_model.Repository) error {
// CheckDaemonExportOK creates/removes git-daemon-export-ok for git-daemon...
func CheckDaemonExportOK(ctx context.Context, repo *repo_model.Repository) error {
- if err := repo.GetOwner(ctx); err != nil {
+ if err := repo.LoadOwner(ctx); err != nil {
return err
}
@@ -379,8 +379,8 @@ func UpdateRepository(ctx context.Context, repo *repo_model.Repository, visibili
}
if visibilityChanged {
- if err = repo.GetOwner(ctx); err != nil {
- return fmt.Errorf("getOwner: %w", err)
+ if err = repo.LoadOwner(ctx); err != nil {
+ return fmt.Errorf("LoadOwner: %w", err)
}
if repo.Owner.IsOrganization() {
// Organization repository need to recalculate access table when visibility is changed.
diff --git a/modules/repository/delete.go b/modules/repository/delete.go
index c7e05e666..01674db4a 100644
--- a/modules/repository/delete.go
+++ b/modules/repository/delete.go
@@ -16,7 +16,7 @@ func CanUserDelete(repo *repo_model.Repository, user *user_model.User) (bool, er
return true, nil
}
- if err := repo.GetOwner(db.DefaultContext); err != nil {
+ if err := repo.LoadOwner(db.DefaultContext); err != nil {
return false, err
}
diff --git a/modules/test/context_tests.go b/modules/test/context_tests.go
index d50f8efc7..6c434c201 100644
--- a/modules/test/context_tests.go
+++ b/modules/test/context_tests.go
@@ -86,7 +86,7 @@ func LoadUser(t *testing.T, ctx *context.Context, userID int64) {
// LoadGitRepo load a git repo into a test context. Requires that ctx.Repo has
// already been populated.
func LoadGitRepo(t *testing.T, ctx *context.Context) {
- assert.NoError(t, ctx.Repo.Repository.GetOwner(ctx))
+ assert.NoError(t, ctx.Repo.Repository.LoadOwner(ctx))
var err error
ctx.Repo.GitRepo, err = git.OpenRepository(ctx, ctx.Repo.Repository.RepoPath())
assert.NoError(t, err)