diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/milestone.go | 7 | ||||
-rw-r--r-- | routers/repo/milestone.go | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go index f3bb4386cb..80d30e2c02 100644 --- a/routers/api/v1/repo/milestone.go +++ b/routers/api/v1/repo/milestone.go @@ -204,7 +204,12 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) { milestone.DeadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) } - if err := models.UpdateMilestone(milestone); err != nil { + var oldIsClosed = milestone.IsClosed + if form.State != nil { + milestone.IsClosed = *form.State == string(api.StateClosed) + } + + if err := models.UpdateMilestone(milestone, oldIsClosed); err != nil { ctx.ServerError("UpdateMilestone", err) return } diff --git a/routers/repo/milestone.go b/routers/repo/milestone.go index 3e81ea0452..25dcd5bc93 100644 --- a/routers/repo/milestone.go +++ b/routers/repo/milestone.go @@ -192,7 +192,7 @@ func EditMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) { m.Name = form.Title m.Content = form.Content m.DeadlineUnix = timeutil.TimeStamp(deadline.Unix()) - if err = models.UpdateMilestone(m); err != nil { + if err = models.UpdateMilestone(m, m.IsClosed); err != nil { ctx.ServerError("UpdateMilestone", err) return } |