Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show only opened milestones on issues page milestone filter #5051

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ func (milestones MilestoneList) getMilestoneIDs() []int64 {
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, 0).
adelowo marked this conversation as resolved.
Show resolved Hide resolved
adelowo marked this conversation as resolved.
Show resolved Hide resolved
Asc("deadline_unix").Find(&miles)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should sort by deadline and then also by id as deadline is optional

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand this.........

Copy link
Member

@lafriks lafriks Oct 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asc("deadline_unix").Asc("id")

}

// GetMilestones returns a list of milestones of given repository and status.
Expand Down
4 changes: 2 additions & 2 deletions routers/api/v1/repo/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
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:
Expand Down