aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/pull_review.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/pull_review.go')
-rw-r--r--routers/api/v1/repo/pull_review.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/routers/api/v1/repo/pull_review.go b/routers/api/v1/repo/pull_review.go
index 323904f45c..55b5178305 100644
--- a/routers/api/v1/repo/pull_review.go
+++ b/routers/api/v1/repo/pull_review.go
@@ -78,14 +78,21 @@ func ListPullReviews(ctx *context.APIContext) {
return
}
- allReviews, err := models.FindReviews(models.FindReviewOptions{
+ opts := models.FindReviewOptions{
ListOptions: utils.GetListOptions(ctx),
Type: models.ReviewTypeUnknown,
IssueID: pr.IssueID,
- })
+ }
+
+ allReviews, err := models.FindReviews(opts)
+ if err != nil {
+ ctx.InternalServerError(err)
+ return
+ }
+ count, err := models.CountReviews(opts)
if err != nil {
- ctx.Error(http.StatusInternalServerError, "FindReviews", err)
+ ctx.InternalServerError(err)
return
}
@@ -95,6 +102,7 @@ func ListPullReviews(ctx *context.APIContext) {
return
}
+ ctx.SetTotalCountHeader(count)
ctx.JSON(http.StatusOK, &apiReviews)
}