From b3b7598ec6846d53d7deb2c84781b06e22c93044 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 13 Dec 2018 23:55:43 +0800 Subject: Improve performance of dashboard (#4977) --- routers/api/v1/repo/issue_comment.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'routers/api/v1/repo/issue_comment.go') 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() -- cgit v1.2.3