mirror of
https://github.com/go-gitea/gitea
synced 2025-07-09 03:57:19 +00:00
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
This commit is contained in:
@ -377,7 +377,7 @@ func PrepareMergedViewPullInfo(ctx *context.Context, issue *models.Issue) *git.C
|
||||
|
||||
if len(compareInfo.Commits) != 0 {
|
||||
sha := compareInfo.Commits[0].ID.String()
|
||||
commitStatuses, _, err := models.GetLatestCommitStatus(ctx.Repo.Repository.ID, sha, db.ListOptions{})
|
||||
commitStatuses, _, err := models.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, sha, db.ListOptions{})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLatestCommitStatus", err)
|
||||
return nil
|
||||
@ -438,7 +438,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
|
||||
ctx.ServerError(fmt.Sprintf("GetRefCommitID(%s)", pull.GetGitRefName()), err)
|
||||
return nil
|
||||
}
|
||||
commitStatuses, _, err := models.GetLatestCommitStatus(repo.ID, sha, db.ListOptions{})
|
||||
commitStatuses, _, err := models.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptions{})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLatestCommitStatus", err)
|
||||
return nil
|
||||
@ -528,7 +528,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
|
||||
return nil
|
||||
}
|
||||
|
||||
commitStatuses, _, err := models.GetLatestCommitStatus(repo.ID, sha, db.ListOptions{})
|
||||
commitStatuses, _, err := models.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptions{})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetLatestCommitStatus", err)
|
||||
return nil
|
||||
@ -767,7 +767,7 @@ func ViewPullFiles(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
currentReview, err := models.GetCurrentReview(ctx.Doer, issue)
|
||||
currentReview, err := models.GetCurrentReview(ctx, ctx.Doer, issue)
|
||||
if err != nil && !models.IsErrReviewNotExist(err) {
|
||||
ctx.ServerError("GetCurrentReview", err)
|
||||
return
|
||||
@ -1354,7 +1354,7 @@ func DownloadPullPatch(ctx *context.Context) {
|
||||
|
||||
// DownloadPullDiffOrPatch render a pull's raw diff or patch
|
||||
func DownloadPullDiffOrPatch(ctx *context.Context, patch bool) {
|
||||
pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
|
||||
pr, err := models.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
|
||||
if err != nil {
|
||||
if models.IsErrPullRequestNotExist(err) {
|
||||
ctx.NotFound("GetPullRequestByIndex", err)
|
||||
@ -1447,7 +1447,7 @@ func UpdatePullRequestTarget(ctx *context.Context) {
|
||||
func SetAllowEdits(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.UpdateAllowEditsForm)
|
||||
|
||||
pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
|
||||
pr, err := models.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
|
||||
if err != nil {
|
||||
if models.IsErrPullRequestNotExist(err) {
|
||||
ctx.NotFound("GetPullRequestByIndex", err)
|
||||
|
Reference in New Issue
Block a user