From 1ac46186ff004861a786a81fe045beddaf790407 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 10 Jun 2020 00:01:36 +0200 Subject: API allow to create closed milestones (#11745) * API allow to create closed milestones * set CloseDate too Co-authored-by: Lauris BH Co-authored-by: techknowlogick --- routers/api/v1/repo/milestone.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'routers') diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go index ee8393aecc..adb9deaee4 100644 --- a/routers/api/v1/repo/milestone.go +++ b/routers/api/v1/repo/milestone.go @@ -144,6 +144,11 @@ func CreateMilestone(ctx *context.APIContext, form api.CreateMilestoneOption) { DeadlineUnix: timeutil.TimeStamp(form.Deadline.Unix()), } + if form.State == "closed" { + milestone.IsClosed = true + milestone.ClosedDateUnix = timeutil.TimeStampNow() + } + if err := models.NewMilestone(milestone); err != nil { ctx.Error(http.StatusInternalServerError, "NewMilestone", err) return -- cgit v1.2.3