Add state param to milestone listing API (#7131)

* Support state params

* update tests

* fix tests

* add state=all support

* update tests

* update swagger

* update swagger
This commit is contained in:
Lanre Adelowo 2019-06-06 01:37:45 +01:00 committed by Lunny Xiao
parent 59e6a7b97f
commit de6539fc8c
8 changed files with 76 additions and 15 deletions

View file

@ -24,6 +24,7 @@ import (
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"github.com/Unknwon/com"
@ -305,7 +306,7 @@ func Issues(ctx *context.Context) {
var err error
// Get milestones.
ctx.Data["Milestones"], err = models.GetMilestonesByRepoID(ctx.Repo.Repository.ID)
ctx.Data["Milestones"], err = models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateType(ctx.Query("state")))
if err != nil {
ctx.ServerError("GetAllRepoMilestones", err)
return