summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-29 14:36:32 +0800
committerGitHub <noreply@github.com>2020-01-29 08:36:32 +0200
commitc09e020558318feebbdce477f91c94411e8959b6 (patch)
tree49a83b33103c114c7068a33bb246e066ae1062e0 /routers/api
parentf29c301040a9de42130b1b1d15f94b5869137f08 (diff)
downloadgitea-c09e020558318feebbdce477f91c94411e8959b6.tar.gz
gitea-c09e020558318feebbdce477f91c94411e8959b6.zip
Fix milestone API state parameter unhandled (#10049)
* Fix milestone API state parameter unhandled * Fix test
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/milestone.go7
1 files changed, 6 insertions, 1 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
}