summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/pull.go')
-rw-r--r--routers/api/v1/repo/pull.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index a01efda1bc..393f2d1576 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -160,7 +160,7 @@ func GetPullRequest(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
- 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()
@@ -220,7 +220,7 @@ func DownloadPullDiffOrPatch(ctx *context.APIContext) {
// "$ref": "#/responses/string"
// "404":
// "$ref": "#/responses/notFound"
- 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()
@@ -470,7 +470,7 @@ func EditPullRequest(ctx *context.APIContext) {
// "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.EditPullRequestOption)
- 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()
@@ -632,7 +632,7 @@ func EditPullRequest(ctx *context.APIContext) {
}
// Refetch from database
- pr, err = models.GetPullRequestByIndex(ctx.Repo.Repository.ID, pr.Index)
+ pr, err = models.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, pr.Index)
if err != nil {
if models.IsErrPullRequestNotExist(err) {
ctx.NotFound()
@@ -676,7 +676,7 @@ func IsPullRequestMerged(ctx *context.APIContext) {
// "404":
// description: pull request has not been merged
- 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()
@@ -730,7 +730,7 @@ func MergePullRequest(ctx *context.APIContext) {
form := web.GetForm(ctx).(*forms.MergePullRequestForm)
- pr, err := models.GetPullRequestByIndexCtx(ctx, 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)
@@ -938,7 +938,7 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
headBranch = headInfos[0]
} else if len(headInfos) == 2 {
- headUser, err = user_model.GetUserByName(headInfos[0])
+ headUser, err = user_model.GetUserByName(ctx, headInfos[0])
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.NotFound("GetUserByName")
@@ -1079,7 +1079,7 @@ func UpdatePullRequest(ctx *context.APIContext) {
// "422":
// "$ref": "#/responses/validationError"
- 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()
@@ -1177,7 +1177,7 @@ func CancelScheduledAutoMerge(ctx *context.APIContext) {
// "$ref": "#/responses/notFound"
pullIndex := ctx.ParamsInt64(":index")
- pull, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, pullIndex)
+ pull, err := models.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, pullIndex)
if err != nil {
if models.IsErrPullRequestNotExist(err) {
ctx.NotFound()
@@ -1198,7 +1198,7 @@ func CancelScheduledAutoMerge(ctx *context.APIContext) {
}
if ctx.Doer.ID != autoMerge.DoerID {
- allowed, err := access_model.IsUserRepoAdminCtx(ctx, ctx.Repo.Repository, ctx.Doer)
+ allowed, err := access_model.IsUserRepoAdmin(ctx, ctx.Repo.Repository, ctx.Doer)
if err != nil {
ctx.InternalServerError(err)
return
@@ -1254,7 +1254,7 @@ func GetPullRequestCommits(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
- 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()