From 61cc13499a65328d8949a55ac056c5b9422cb17d Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Fri, 11 May 2018 13:40:17 +0200 Subject: [PATCH] Add support for single comments Showing buttons in context Signed-off-by: Jonas Franz --- modules/auth/repo_form.go | 2 +- routers/repo/pull.go | 6 +++++- templates/repo/diff/comment_form.tmpl | 15 ++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index cada797d69..80ae8bbaa9 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -363,7 +363,7 @@ type CodeCommentForm struct { Line int64 TreePath string `form:"path" binding:"Required"` CommitSHA string `form:"commit_id" binding:"Required"` - IsReview bool `form:"is_review" binding:"Required"` + IsReview bool `form:"is_review"` } // Validate validates the fields diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 3768b3f385..a300d78366 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -477,7 +477,11 @@ func ViewPullFiles(ctx *context.Context) { return } ctx.Data["CodeComments"] = pathToLineToComment - + ctx.Data["CurrentReview"], err = models.GetCurrentReview(ctx.User, issue) + if err != nil && !models.IsErrReviewNotExist(err) { + ctx.ServerError("GetCurrentReview", err) + return + } ctx.HTML(200, tplPullFiles) } diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index ea604bcc45..a27494ab42 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -4,7 +4,6 @@ - @@ -23,10 +22,16 @@