aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/pull.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-05-07 05:35:12 +0000
committerGitHub <noreply@github.com>2022-05-07 01:35:12 -0400
commit0eac09e0662ae70b8b6e3e5e8c33547c79ff7124 (patch)
treed5dc0a6ed8c4c1b92a273277380300289103d328 /routers/web/repo/pull.go
parent5a9c505e148a06cc652cab52bf7a59b23e605282 (diff)
downloadgitea-0eac09e0662ae70b8b6e3e5e8c33547c79ff7124.tar.gz
gitea-0eac09e0662ae70b8b6e3e5e8c33547c79ff7124.zip
Improve reviewing PR UX (#19612)
Diffstat (limited to 'routers/web/repo/pull.go')
-rw-r--r--routers/web/repo/pull.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 74028c316c..7cedeec10e 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -752,11 +752,27 @@ func ViewPullFiles(ctx *context.Context) {
if ctx.Written() {
return
}
- ctx.Data["CurrentReview"], err = models.GetCurrentReview(ctx.Doer, issue)
+
+ currentReview, err := models.GetCurrentReview(ctx.Doer, issue)
if err != nil && !models.IsErrReviewNotExist(err) {
ctx.ServerError("GetCurrentReview", err)
return
}
+ numPendingCodeComments := int64(0)
+ if currentReview != nil {
+ numPendingCodeComments, err = models.CountComments(&models.FindCommentsOptions{
+ Type: models.CommentTypeCode,
+ ReviewID: currentReview.ID,
+ IssueID: issue.ID,
+ })
+ if err != nil {
+ ctx.ServerError("CountComments", err)
+ return
+ }
+ }
+ ctx.Data["CurrentReview"] = currentReview
+ ctx.Data["PendingCodeCommentNumber"] = numPendingCodeComments
+
getBranchData(ctx, issue)
ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.Doer.ID)
ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)