diff options
author | Norwin <noerw@users.noreply.github.com> | 2021-03-13 18:06:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-13 19:06:52 +0100 |
commit | 658d1bfac8c4706d83004c4069cd52ef63fb71cb (patch) | |
tree | bd92f05b5483e6a7dd12c2f9912c3f71a4ddc178 /routers | |
parent | e256a62257df85c9fdb53426cc5b28bf422d91af (diff) | |
download | gitea-658d1bfac8c4706d83004c4069cd52ef63fb71cb.tar.gz gitea-658d1bfac8c4706d83004c4069cd52ef63fb71cb.zip |
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>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/pull.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 8eda949652..e3be5b4af4 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -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, |