aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/issue_comment.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2018-12-13 23:55:43 +0800
committertechknowlogick <hello@techknowlogick.com>2018-12-13 10:55:43 -0500
commitb3b7598ec6846d53d7deb2c84781b06e22c93044 (patch)
tree53c85943b23867b20e2b31742fbe06fcda088ccd /routers/api/v1/repo/issue_comment.go
parent49ea6e0deb7ecef327b0c2f41920f75c6aaf80d3 (diff)
downloadgitea-b3b7598ec6846d53d7deb2c84781b06e22c93044.tar.gz
gitea-b3b7598ec6846d53d7deb2c84781b06e22c93044.zip
Improve performance of dashboard (#4977)
Diffstat (limited to 'routers/api/v1/repo/issue_comment.go')
-rw-r--r--routers/api/v1/repo/issue_comment.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 3af0290585..a3fc6f41f3 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -51,7 +51,7 @@ func ListIssueComments(ctx *context.APIContext) {
}
// comments,err:=models.GetCommentsByIssueIDSince(, since)
- issue, err := models.GetRawIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
+ issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
ctx.Error(500, "GetRawIssueByIndex", err)
return
@@ -68,6 +68,10 @@ func ListIssueComments(ctx *context.APIContext) {
}
apiComments := make([]*api.Comment, len(comments))
+ if err = models.CommentList(comments).LoadPosters(); err != nil {
+ ctx.Error(500, "LoadPosters", err)
+ return
+ }
for i := range comments {
apiComments[i] = comments[i].APIFormat()
}
@@ -114,6 +118,11 @@ func ListRepoIssueComments(ctx *context.APIContext) {
return
}
+ if err = models.CommentList(comments).LoadPosters(); err != nil {
+ ctx.Error(500, "LoadPosters", err)
+ return
+ }
+
apiComments := make([]*api.Comment, len(comments))
for i := range comments {
apiComments[i] = comments[i].APIFormat()