aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-11-24 02:46:16 -0300
committertechknowlogick <techknowlogick@gitea.io>2019-11-24 00:46:16 -0500
commitd779deef6ec95db35299096cc1170ada553b102c (patch)
treee9c3432ebd351ff0f5d806f5a426bf12d0470468 /models
parent8ab35eefc4ff5db3f2f0a62f6f0272eae9be0585 (diff)
downloadgitea-d779deef6ec95db35299096cc1170ada553b102c.tar.gz
gitea-d779deef6ec95db35299096cc1170ada553b102c.zip
Fix show single review comments in the PR page (#9143)
Diffstat (limited to 'models')
-rw-r--r--models/review.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/review.go b/models/review.go
index 0dc44a2a4c..fb989b2b35 100644
--- a/models/review.go
+++ b/models/review.go
@@ -223,6 +223,11 @@ func getCurrentReview(e Engine, reviewer *User, issue *Issue) (*Review, error) {
return reviews[0], nil
}
+// ReviewExists returns whether a review exists for a particular line of code in the PR
+func ReviewExists(issue *Issue, treePath string, line int64) (bool, error) {
+ return x.Cols("id").Exist(&Comment{IssueID: issue.ID, TreePath: treePath, Line: line, Type: CommentTypeCode})
+}
+
// GetCurrentReview returns the current pending review of reviewer for given issue
func GetCurrentReview(reviewer *User, issue *Issue) (*Review, error) {
return getCurrentReview(x, reviewer, issue)