mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
API: fix set milestone on PR creation (#14981)
* API: fix set milestone on PR creation pr creation via API failed with 404, because we searched for milestoneID 0, due to uninitialized var usage D: * add tests * fix expected status codes * fix tests Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
e256a62257
commit
658d1bfac8
5 changed files with 91 additions and 5 deletions
|
@ -295,7 +295,6 @@ func CreatePullRequest(ctx *context.APIContext) {
|
|||
var (
|
||||
repo = ctx.Repo.Repository
|
||||
labelIDs []int64
|
||||
assigneeID int64
|
||||
milestoneID int64
|
||||
)
|
||||
|
||||
|
@ -356,7 +355,7 @@ func CreatePullRequest(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
if form.Milestone > 0 {
|
||||
milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, milestoneID)
|
||||
milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, form.Milestone)
|
||||
if err != nil {
|
||||
if models.IsErrMilestoneNotExist(err) {
|
||||
ctx.NotFound()
|
||||
|
@ -380,7 +379,6 @@ func CreatePullRequest(ctx *context.APIContext) {
|
|||
PosterID: ctx.User.ID,
|
||||
Poster: ctx.User,
|
||||
MilestoneID: milestoneID,
|
||||
AssigneeID: assigneeID,
|
||||
IsPull: true,
|
||||
Content: form.Body,
|
||||
DeadlineUnix: deadlineUnix,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue