diff options
author | 6543 <6543@obermui.de> | 2020-06-10 00:01:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 18:01:36 -0400 |
commit | 1ac46186ff004861a786a81fe045beddaf790407 (patch) | |
tree | 179108d99d750bc77fb3a5ce5b6ccd865de807ea /routers | |
parent | 19db3f4f0a6739e10aaa36d86ef5fd89dcf71467 (diff) | |
download | gitea-1ac46186ff004861a786a81fe045beddaf790407.tar.gz gitea-1ac46186ff004861a786a81fe045beddaf790407.zip |
API allow to create closed milestones (#11745)
* API allow to create closed milestones
* set CloseDate too
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/milestone.go | 5 |
1 files changed, 5 insertions, 0 deletions
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 |