mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
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:
@@ -81,7 +81,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("PushUpdates: %s/%s", optsList[0].RepoUserName, optsList[0].RepoName))
|
||||
defer finished()
|
||||
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(optsList[0].RepoUserName, optsList[0].RepoName)
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(ctx, optsList[0].RepoUserName, optsList[0].RepoName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("GetRepositoryByOwnerAndName failed: %w", err)
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
if opts.IsTag() { // If is tag reference
|
||||
if pusher == nil || pusher.ID != opts.PusherID {
|
||||
var err error
|
||||
if pusher, err = user_model.GetUserByID(opts.PusherID); err != nil {
|
||||
if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
} else if opts.IsBranch() { // If is branch reference
|
||||
if pusher == nil || pusher.ID != opts.PusherID {
|
||||
var err error
|
||||
if pusher, err = user_model.GetUserByID(opts.PusherID); err != nil {
|
||||
if pusher, err = user_model.GetUserByID(ctx, opts.PusherID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user