diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-12-03 10:48:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-03 10:48:26 +0800 |
commit | 0a7d3ff786508284224ada17956a65bb759d9265 (patch) | |
tree | 4860fca95c1432ab59c6723ee2b053b1c7d6779d /models/repo.go | |
parent | 8698458f48eafeab21014db544aa7160368856e1 (diff) | |
download | gitea-0a7d3ff786508284224ada17956a65bb759d9265.tar.gz gitea-0a7d3ff786508284224ada17956a65bb759d9265.zip |
refactor some functions to support ctx as first parameter (#21878)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/repo.go b/models/repo.go index ca4f60a2f3..5d333a3aee 100644 --- a/models/repo.go +++ b/models/repo.go @@ -52,7 +52,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error { sess := db.GetEngine(ctx) // In case is a organization. - org, err := user_model.GetUserByIDCtx(ctx, uid) + org, err := user_model.GetUserByID(ctx, uid) if err != nil { return err } @@ -191,7 +191,7 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error { } } - if err := project_model.DeleteProjectByRepoIDCtx(ctx, repoID); err != nil { + if err := project_model.DeleteProjectByRepoID(ctx, repoID); err != nil { return fmt.Errorf("unable to delete projects for repo[%d]: %w", repoID, err) } @@ -523,7 +523,7 @@ func CheckRepoStats(ctx context.Context) error { } log.Trace("Updating repository count 'num_forks': %d", id) - repo, err := repo_model.GetRepositoryByID(id) + repo, err := repo_model.GetRepositoryByID(ctx, id) if err != nil { log.Error("repo_model.GetRepositoryByID[%d]: %v", id, err) continue @@ -618,7 +618,7 @@ func DeleteDeployKey(ctx context.Context, doer *user_model.User, id int64) error // Check if user has access to delete this key. if !doer.IsAdmin { - repo, err := repo_model.GetRepositoryByIDCtx(ctx, key.RepoID) + repo, err := repo_model.GetRepositoryByID(ctx, key.RepoID) if err != nil { return fmt.Errorf("GetRepositoryByID: %w", err) } |