"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
api "code.gitea.io/sdk/gitea"
-
"github.com/go-xorm/xorm"
)
return ids
}
-// GetMilestonesByRepoID returns all milestones of a repository.
+// GetMilestonesByRepoID returns all opened milestones of a repository.
func GetMilestonesByRepoID(repoID int64) (MilestoneList, error) {
miles := make([]*Milestone, 0, 10)
- return miles, x.Where("repo_id = ?", repoID).Asc("deadline_unix").Find(&miles)
+ return miles, x.Where("repo_id = ? AND is_closed = ?", repoID, false).
+ Asc("deadline_unix").Asc("id").Find(&miles)
}
// GetMilestones returns a list of milestones of given repository and status.
api "code.gitea.io/sdk/gitea"
)
-// ListMilestones list all the milestones for a repository
+// ListMilestones list all the opened milestones for a repository
func ListMilestones(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo}/milestones issue issueGetMilestonesList
// ---
- // summary: Get all of a repository's milestones
+ // summary: Get all of a repository's opened milestones
// produces:
// - application/json
// parameters:
"tags": [
"issue"
],
- "summary": "Get all of a repository's milestones",
+ "summary": "Get all of a repository's opened milestones",
"operationId": "issueGetMilestonesList",
"parameters": [
{