summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/milestone.go8
-rw-r--r--routers/repo/issue.go3
2 files changed, 8 insertions, 3 deletions
diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go
index 1d01093306..14030a2186 100644
--- a/routers/api/v1/repo/milestone.go
+++ b/routers/api/v1/repo/milestone.go
@@ -14,7 +14,7 @@ import (
api "code.gitea.io/gitea/modules/structs"
)
-// ListMilestones list all the opened milestones for a repository
+// ListMilestones list milestones for a repository
func ListMilestones(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo}/milestones issue issueGetMilestonesList
// ---
@@ -32,10 +32,14 @@ func ListMilestones(ctx *context.APIContext) {
// description: name of the repo
// type: string
// required: true
+ // - name: state
+ // in: query
+ // description: Milestone state, Recognised values are open, closed and all. Defaults to "open"
+ // type: string
// responses:
// "200":
// "$ref": "#/responses/MilestoneList"
- milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID)
+ milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateType(ctx.Query("state")))
if err != nil {
ctx.Error(500, "GetMilestonesByRepoID", err)
return
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index c2749fcb47..f6030c9823 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -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