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>
This commit is contained in:
parent
8698458f48
commit
0a7d3ff786
145 changed files with 360 additions and 369 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue