Skip to content

Commit

Permalink
Milestone issues and pull requests (#5293)
Browse files Browse the repository at this point in the history
* add milestone issues and pulls page instead of redirecting issues page

* add milestone when creating issue from milestone page

* refactor to merge similiar codes as a new function issues

* remove milestone info on milestone issues list

* fix missing params
  • Loading branch information
lunny authored Nov 29, 2018
1 parent d5d847e commit 2dc805c
Show file tree
Hide file tree
Showing 8 changed files with 572 additions and 261 deletions.
12 changes: 9 additions & 3 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ type IssueStatsOptions struct {
AssigneeID int64
MentionedID int64
PosterID int64
IsPull bool
IsPull util.OptionalBool
IssueIDs []int64
}

Expand All @@ -1411,8 +1411,7 @@ func GetIssueStats(opts *IssueStatsOptions) (*IssueStats, error) {

countSession := func(opts *IssueStatsOptions) *xorm.Session {
sess := x.
Where("issue.repo_id = ?", opts.RepoID).
And("issue.is_pull = ?", opts.IsPull)
Where("issue.repo_id = ?", opts.RepoID)

if len(opts.IssueIDs) > 0 {
sess.In("issue.id", opts.IssueIDs)
Expand Down Expand Up @@ -1447,6 +1446,13 @@ func GetIssueStats(opts *IssueStatsOptions) (*IssueStats, error) {
And("issue_user.is_mentioned = ?", true)
}

switch opts.IsPull {
case util.OptionalBoolTrue:
sess.And("issue.is_pull=?", true)
case util.OptionalBoolFalse:
sess.And("issue.is_pull=?", false)
}

return sess
}

Expand Down
12 changes: 12 additions & 0 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ func GetMilestoneByRepoID(repoID, id int64) (*Milestone, error) {
return getMilestoneByRepoID(x, repoID, id)
}

// GetMilestoneByID returns the milestone via id .
func GetMilestoneByID(id int64) (*Milestone, error) {
var m Milestone
has, err := x.ID(id).Get(&m)
if err != nil {
return nil, err
} else if !has {
return nil, ErrMilestoneNotExist{id, 0}
}
return &m, nil
}

// MilestoneList is a list of milestones offering additional functionality
type MilestoneList []*Milestone

Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ milestones.no_due_date = No due date
milestones.open = Open
milestones.close = Close
milestones.new_subheader = Milestones organize issues and track progress.
milestones.completeness = %d%% Completed
milestones.create = Create Milestone
milestones.title = Title
milestones.desc = Description
Expand Down
Loading

0 comments on commit 2dc805c

Please sign in to comment.