summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorJustin Nuß <justin.nuss@hmmh.de>2014-07-24 12:29:37 +0200
committerJustin Nuß <justin.nuss@hmmh.de>2014-07-24 12:29:37 +0200
commit967856f36ebd2d6216ceb2299b5399f7d25e86e9 (patch)
treebfde3326df1efcda39927bea2b44e9dcc0d436e5 /routers
parent3c025b395077292a721419942f997311ef575fd9 (diff)
parenta76a948a029f46697a0e2327ea6ca86872a760d7 (diff)
downloadgitea-967856f36ebd2d6216ceb2299b5399f7d25e86e9.tar.gz
gitea-967856f36ebd2d6216ceb2299b5399f7d25e86e9.zip
Merge branch 'dev' into feature/attachments
Conflicts: models/issue.go routers/repo/issue.go
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/issue.go31
1 files changed, 9 insertions, 22 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 3a0a540e3b..c9d3112eaa 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -399,7 +399,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["AllowedTypes"] = setting.AttachmentAllowedTypes
@@ -652,30 +655,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, "", nil); err != nil {
@@ -693,7 +680,7 @@ func Comment(ctx *middleware.Context, params martini.Params) {
if len(content) > 0 {
switch params["action"] {
case "new":
- if comment, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.Id, 0, 0, models.IT_PLAIN, content, nil); err != nil {
+ if comment, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.Id, 0, 0, models.COMMENT, content, nil); err != nil {
ctx.Handle(500, "issue.Comment(create comment)", err)
return
}