1
0
Fork 0
forked from forgejo/forgejo

Improve performance of dashboard (#4977)

This commit is contained in:
Lunny Xiao 2018-12-13 23:55:43 +08:00 committed by techknowlogick
parent 49ea6e0deb
commit b3b7598ec6
19 changed files with 350 additions and 94 deletions

View file

@ -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()