diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index a819a60491..a4a00d53b4 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -377,6 +377,7 @@ type CodeCommentForm struct { Line int64 TreePath string `form:"path" binding:"Required"` IsReview bool `form:"is_review"` + Reply int64 `form:"reply"` } // Validate validates the fields diff --git a/routers/repo/pull_review.go b/routers/repo/pull_review.go index 91257fea33..7576ebe90b 100644 --- a/routers/repo/pull_review.go +++ b/routers/repo/pull_review.go @@ -63,6 +63,9 @@ func CreateCodeComment(ctx *context.Context, form auth.CodeCommentForm) { } } } + if review.ID == 0 { + review.ID = form.Reply + } //FIXME check if line, commit and treepath exist comment, err := models.CreateCodeComment( ctx.User, @@ -78,7 +81,7 @@ func CreateCodeComment(ctx *context.Context, form auth.CodeCommentForm) { return } // Send no notification if comment is pending - if !form.IsReview { + if !form.IsReview || form.Reply != 0 { notification.NotifyCreateIssueComment(ctx.User, issue.Repo, issue, comment) } diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index b5bc3ee073..729e37c8b9 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -151,7 +151,7 @@ {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} - {{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}} + {{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}} {{end}} @@ -164,7 +164,7 @@ {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} - {{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}} + {{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}} {{end}} diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 9683c3e401..9eb557d86b 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -25,19 +25,19 @@
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index ee10ff56f0..4e79fd866c 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -342,7 +342,7 @@ {{end}} - {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" true "root" $ "comment" (index $comms 0)}} + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}} {{end}}