新增:重新打开pr接口
This commit is contained in:
parent
b015baf624
commit
8910972c65
2
main.go
2
main.go
|
|
@ -22,7 +22,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
Version = "v2.8, by v1.21.0 "
|
||||
Version = "v2.8.1, by v1.21.0 "
|
||||
Tags = ""
|
||||
MakeVersion = ""
|
||||
)
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ func Routers() *web.Route {
|
|||
m.Get("", repo.ListPullRequestVersions)
|
||||
m.Get("/{versionId}/diff", context.ReferencesGitRepo(), repo.GetPullRequestVersionDiff)
|
||||
})
|
||||
m.Get("/change_status", repo.ChangePullRequestCloseStatus)
|
||||
})
|
||||
}, mustAllowPulls, reqRepoReader(unit_model.TypeCode), context.ReferencesGitRepo())
|
||||
m.Group("/releases", func() {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,25 @@ import (
|
|||
hat_pull_service "code.gitlink.org.cn/Gitlink/gitea_hat.git/services/pull"
|
||||
)
|
||||
|
||||
func ChangePullRequestCloseStatus(ctx *context.APIContext) {
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
|
||||
if err != nil {
|
||||
if issues_model.IsErrPullRequestNotExist(err) {
|
||||
ctx.NotFound()
|
||||
} else {
|
||||
ctx.Error(http.StatusInternalServerError, "GetPullRequestByIndex", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
changeStatus := ctx.FormBool("is_closed")
|
||||
_, err = issues_model.ChangeIssueStatus(ctx, pr.Issue, ctx.Doer, changeStatus)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "ChangeIssueStatus", err)
|
||||
}
|
||||
|
||||
ctx.Status(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func CreatePrVersion(ctx *context.APIContext) {
|
||||
form := web.GetForm(ctx).(*gitea_api.PullRequestPayload)
|
||||
hat_pull_service.AddToTaskQueue(&issues_model.PullRequest{ID: form.PullRequest.ID}, string(form.Action))
|
||||
|
|
|
|||
Loading…
Reference in New Issue