mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Move pull request api convert to convert package (#9664)
* Move pull request api convert to convert package * Rename ToPullRequest to ToAPIPullRequest
This commit is contained in:
@ -13,6 +13,7 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/auth"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
@ -102,7 +103,7 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions)
|
||||
ctx.Error(http.StatusInternalServerError, "GetHeadRepo", err)
|
||||
return
|
||||
}
|
||||
apiPrs[i] = prs[i].APIFormat()
|
||||
apiPrs[i] = convert.ToAPIPullRequest(prs[i])
|
||||
}
|
||||
|
||||
ctx.SetLinkHeader(int(maxResults), models.ItemsPerPage)
|
||||
@ -157,7 +158,7 @@ func GetPullRequest(ctx *context.APIContext) {
|
||||
ctx.Error(http.StatusInternalServerError, "GetHeadRepo", err)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, pr.APIFormat())
|
||||
ctx.JSON(http.StatusOK, convert.ToAPIPullRequest(pr))
|
||||
}
|
||||
|
||||
// CreatePullRequest does what it says
|
||||
@ -321,7 +322,7 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
|
||||
notification.NotifyNewPullRequest(pr)
|
||||
|
||||
log.Trace("Pull request created: %d/%d", repo.ID, prIssue.ID)
|
||||
ctx.JSON(http.StatusCreated, pr.APIFormat())
|
||||
ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr))
|
||||
}
|
||||
|
||||
// EditPullRequest does what it says
|
||||
@ -479,7 +480,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
|
||||
}
|
||||
|
||||
// TODO this should be 200, not 201
|
||||
ctx.JSON(http.StatusCreated, pr.APIFormat())
|
||||
ctx.JSON(http.StatusCreated, convert.ToAPIPullRequest(pr))
|
||||
}
|
||||
|
||||
// IsPullRequestMerged checks if a PR exists given an index
|
||||
|
Reference in New Issue
Block a user