diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-07-24 04:25:00 -0400 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-07-24 04:25:00 -0400 |
commit | a76a948a029f46697a0e2327ea6ca86872a760d7 (patch) | |
tree | 52e07c859411253fd87f29a3e6798e3f082b0459 /routers/repo/issue.go | |
parent | 6e9f1c52b18f112eecd5c72e295cfea1809f07fa (diff) | |
parent | d43c5895bc5026fb29dd9aa509056e49b4644ba7 (diff) |
Merge pull request #305 from nuss-justin/feature/commit-issue-fix
Fix #302. Show referencing commits in issue.
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index e71c835f..2d1c23d4 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -393,7 +393,10 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { return } comments[i].Poster = u - comments[i].Content = string(base.RenderMarkdown([]byte(comments[i].Content), ctx.Repo.RepoLink)) + + if comments[i].Type == models.COMMENT { + comments[i].Content = string(base.RenderMarkdown([]byte(comments[i].Content), ctx.Repo.RepoLink)) + } } ctx.Data["Title"] = issue.Name @@ -644,30 +647,14 @@ func Comment(ctx *middleware.Context, params martini.Params) { // Change open/closed issue counter for the associated milestone if issue.MilestoneId > 0 { - l, err := models.GetMilestoneById(issue.MilestoneId) - - if err != nil { - ctx.Handle(500, "issue.Comment(GetLabelById)", err) - return - } - - if issue.IsClosed { - l.NumOpenIssues = l.NumOpenIssues - 1 - l.NumClosedIssues = l.NumClosedIssues + 1 - } else { - l.NumOpenIssues = l.NumOpenIssues + 1 - l.NumClosedIssues = l.NumClosedIssues - 1 - } - - if err = models.UpdateMilestone(l); err != nil { - ctx.Handle(500, "issue.Comment(UpdateLabel)", err) - return + if err = models.ChangeMilestoneIssueStats(issue); err != nil { + ctx.Handle(500, "issue.Comment(ChangeMilestoneIssueStats)", err) } } - cmtType := models.IT_CLOSE + cmtType := models.CLOSE if !issue.IsClosed { - cmtType = models.IT_REOPEN + cmtType = models.REOPEN } if err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.Id, 0, 0, cmtType, ""); err != nil { @@ -683,7 +670,7 @@ func Comment(ctx *middleware.Context, params martini.Params) { if len(content) > 0 { switch params["action"] { case "new": - if err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.Id, 0, 0, models.IT_PLAIN, content); err != nil { + if err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.Id, 0, 0, models.COMMENT, content); err != nil { ctx.Handle(500, "issue.Comment(create comment)", err) return } |