Skip to content

Commit dedb156

Browse files
Fix #321. Allow empty comments as long as there are attachments.
1 parent 30d7397 commit dedb156

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

routers/repo/issue.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,8 @@ func Comment(ctx *middleware.Context, params martini.Params) {
755755

756756
var ms []string
757757
content := ctx.Query("content")
758-
if len(content) > 0 {
758+
// Fix #321. Allow empty comments, as long as we have attachments.
759+
if len(content) > 0 || len(ctx.Req.MultipartForm.File["attachments"]) > 0 {
759760
switch params["action"] {
760761
case "new":
761762
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) {
10811082

10821083
// Fix #312. Attachments with , in their name are not handled correctly by Google Chrome.
10831084
// We must put the name in " manually.
1084-
ctx.ServeFile(attachment.Path, "\"" + attachment.Name + "\"")
1085+
ctx.ServeFile(attachment.Path, "\""+attachment.Name+"\"")
10851086
}

templates/repo/issue/view.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@
7272
<span class="role label label-default pull-right">Owner</span>
7373
</div>
7474
<div class="panel-body markdown">
75+
{{if len .Content}}
7576
{{str2html .Content}}
77+
{{else}}
78+
<i>No comment entered</i>
79+
{{end}}
7680
</div>
7781
{{with $attachments := .Attachments}}
7882
{{if $attachments}}

0 commit comments

Comments
 (0)