tokarchuk/v1.17
Unknwon 9 years ago
parent 9311a9858a
commit ce4dcf1e83
  1. 4
      models/issue.go
  2. 14
      routers/repo/issue.go

@ -704,8 +704,8 @@ func GetMilestoneByIndex(repoId, idx int64) (*Milestone, error) {
return m, nil return m, nil
} }
// Milestones returns a list of milestones of given repository and status. // GetMilestones returns a list of milestones of given repository and status.
func Milestones(repoID int64, page int, isClosed bool) ([]*Milestone, error) { func GetMilestones(repoID int64, page int, isClosed bool) ([]*Milestone, error) {
miles := make([]*Milestone, 0, setting.IssuePagingNum) miles := make([]*Milestone, 0, setting.IssuePagingNum)
sess := x.Where("repo_id=? AND is_closed=?", repoID, isClosed) sess := x.Where("repo_id=? AND is_closed=?", repoID, isClosed)
if page > 0 { if page > 0 {

@ -176,12 +176,12 @@ func CreateIssue(ctx *middleware.Context) {
err error err error
) )
// Get all milestones. // Get all milestones.
ctx.Data["OpenMilestones"], err = models.Milestones(repo.Id, -1, false) ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.Id, -1, false)
if err != nil { if err != nil {
ctx.Handle(500, "GetMilestones.1: %v", err) ctx.Handle(500, "GetMilestones.1: %v", err)
return return
} }
ctx.Data["ClosedMilestones"], err = models.Milestones(repo.Id, -1, true) ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.Id, -1, true)
if err != nil { if err != nil {
ctx.Handle(500, "GetMilestones.2: %v", err) ctx.Handle(500, "GetMilestones.2: %v", err)
return return
@ -220,12 +220,12 @@ func CreateIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
var err error var err error
// Get all milestones. // Get all milestones.
_, err = models.Milestones(ctx.Repo.Repository.Id, -1, false) _, err = models.GetMilestones(ctx.Repo.Repository.Id, -1, false)
if err != nil { if err != nil {
send(500, nil, err) send(500, nil, err)
return return
} }
_, err = models.Milestones(ctx.Repo.Repository.Id, -1, true) _, err = models.GetMilestones(ctx.Repo.Repository.Id, -1, true)
if err != nil { if err != nil {
send(500, nil, err) send(500, nil, err)
return return
@ -385,12 +385,12 @@ func ViewIssue(ctx *middleware.Context) {
} }
// Get all milestones. // Get all milestones.
ctx.Data["OpenMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, -1, false) ctx.Data["OpenMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, -1, false)
if err != nil { if err != nil {
ctx.Handle(500, "issue.ViewIssue(GetMilestones.1): %v", err) ctx.Handle(500, "issue.ViewIssue(GetMilestones.1): %v", err)
return return
} }
ctx.Data["ClosedMilestones"], err = models.Milestones(ctx.Repo.Repository.Id, -1, true) ctx.Data["ClosedMilestones"], err = models.GetMilestones(ctx.Repo.Repository.Id, -1, true)
if err != nil { if err != nil {
ctx.Handle(500, "issue.ViewIssue(GetMilestones.2): %v", err) ctx.Handle(500, "issue.ViewIssue(GetMilestones.2): %v", err)
return return
@ -988,7 +988,7 @@ func Milestones(ctx *middleware.Context) {
} }
ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5)
miles, err := models.Milestones(ctx.Repo.Repository.Id, page, isShowClosed) miles, err := models.GetMilestones(ctx.Repo.Repository.Id, page, isShowClosed)
if err != nil { if err != nil {
ctx.Handle(500, "GetMilestones", err) ctx.Handle(500, "GetMilestones", err)
return return

Loading…
Cancel
Save