mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Make more functions use ctx instead of db.DefaultContext (#24068)
Continue the "ctx refactoring" work. There are still a lot db.DefaultContext, incorrect context could cause database deadlock errors.
This commit is contained in:
@@ -90,7 +90,7 @@ func CreatePushPullComment(ctx context.Context, pusher *user_model.User, pr *iss
|
||||
|
||||
ops.Content = string(dataJSON)
|
||||
|
||||
comment, err = issue_service.CreateComment(ops)
|
||||
comment, err = issue_service.CreateComment(ctx, ops)
|
||||
|
||||
return comment, err
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, pull *issu
|
||||
}
|
||||
|
||||
for _, assigneeID := range assigneeIDs {
|
||||
if err := issue_service.AddAssigneeIfNotAssigned(pull, pull.Poster, assigneeID); err != nil {
|
||||
if err := issue_service.AddAssigneeIfNotAssigned(ctx, pull, pull.Poster, assigneeID); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, pull *issu
|
||||
Content: string(dataJSON),
|
||||
}
|
||||
|
||||
_, _ = issue_service.CreateComment(ops)
|
||||
_, _ = issue_service.CreateComment(ctx, ops)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -221,7 +221,7 @@ func ChangeTargetBranch(ctx context.Context, pr *issues_model.PullRequest, doer
|
||||
OldRef: oldBranch,
|
||||
NewRef: targetBranch,
|
||||
}
|
||||
if _, err = issue_service.CreateComment(options); err != nil {
|
||||
if _, err = issue_service.CreateComment(ctx, options); err != nil {
|
||||
return fmt.Errorf("CreateChangeTargetBranchComment: %w", err)
|
||||
}
|
||||
|
||||
|
@@ -248,7 +248,7 @@ func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_mo
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return issue_service.CreateComment(&issues_model.CreateCommentOptions{
|
||||
return issue_service.CreateComment(ctx, &issues_model.CreateCommentOptions{
|
||||
Type: issues_model.CommentTypeCode,
|
||||
Doer: doer,
|
||||
Repo: repo,
|
||||
@@ -368,7 +368,7 @@ func DismissReview(ctx context.Context, reviewID, repoID int64, message string,
|
||||
return
|
||||
}
|
||||
|
||||
comment, err = issue_service.CreateComment(&issues_model.CreateCommentOptions{
|
||||
comment, err = issue_service.CreateComment(ctx, &issues_model.CreateCommentOptions{
|
||||
Doer: doer,
|
||||
Content: message,
|
||||
Type: issues_model.CommentTypeDismissReview,
|
||||
|
Reference in New Issue
Block a user