diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-07-25 02:41:22 -0400 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-07-25 02:41:22 -0400 |
commit | 204ef41b0961379f0ba33fad98bed335582c45ea (patch) | |
tree | 67115dfd223f10d02a4447648135ff88c56bc7bf | |
parent | 30d7397f9745286282bce2dec960aa9e0e02af94 (diff) | |
parent | dedb156d4a484d5104113959bb95bc214be40b2b (diff) | |
download | gitea-204ef41b0961379f0ba33fad98bed335582c45ea.tar.gz gitea-204ef41b0961379f0ba33fad98bed335582c45ea.zip |
Merge pull request #322 from nuss-justin/issue/321
Fix #321. Allow empty comments as long as there are attachments.
-rw-r--r-- | routers/repo/issue.go | 5 | ||||
-rw-r--r-- | templates/repo/issue/view.tmpl | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index a5a2a28eca..0f03cea576 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -755,7 +755,8 @@ func Comment(ctx *middleware.Context, params martini.Params) { var ms []string content := ctx.Query("content") - if len(content) > 0 { + // Fix #321. Allow empty comments, as long as we have attachments. + if len(content) > 0 || len(ctx.Req.MultipartForm.File["attachments"]) > 0 { switch params["action"] { case "new": if comment, err = models.CreateComment(ctx.User.Id, ctx.Repo.Repository.Id, issue.Id, 0, 0, models.COMMENT, content, nil); err != nil { @@ -1081,5 +1082,5 @@ func IssueGetAttachment(ctx *middleware.Context, params martini.Params) { // Fix #312. Attachments with , in their name are not handled correctly by Google Chrome. // We must put the name in " manually. - ctx.ServeFile(attachment.Path, "\"" + attachment.Name + "\"") + ctx.ServeFile(attachment.Path, "\""+attachment.Name+"\"") } diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index 570698975b..247931c4aa 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -72,7 +72,11 @@ <span class="role label label-default pull-right">Owner</span> </div> <div class="panel-body markdown"> + {{if len .Content}} {{str2html .Content}} + {{else}} + <i>No comment entered</i> + {{end}} </div> {{with $attachments := .Attachments}} {{if $attachments}} |