summaryrefslogtreecommitdiffstats
path: root/models/issues/comment_list.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issues/comment_list.go')
-rw-r--r--models/issues/comment_list.go27
1 files changed, 4 insertions, 23 deletions
diff --git a/models/issues/comment_list.go b/models/issues/comment_list.go
index 2b55bc212f..0411d44531 100644
--- a/models/issues/comment_list.go
+++ b/models/issues/comment_list.go
@@ -29,32 +29,13 @@ func (comments CommentList) LoadPosters(ctx context.Context) error {
return nil
}
- posterIDs := comments.getPosterIDs()
- posterMaps := make(map[int64]*user_model.User, len(posterIDs))
- left := len(posterIDs)
- for left > 0 {
- limit := db.DefaultMaxInSize
- if left < limit {
- limit = left
- }
- err := db.GetEngine(ctx).
- In("id", posterIDs[:limit]).
- Find(&posterMaps)
- if err != nil {
- return err
- }
- left -= limit
- posterIDs = posterIDs[limit:]
+ posterMaps, err := getPosters(ctx, comments.getPosterIDs())
+ if err != nil {
+ return err
}
for _, comment := range comments {
- if comment.PosterID <= 0 {
- continue
- }
- var ok bool
- if comment.Poster, ok = posterMaps[comment.PosterID]; !ok {
- comment.Poster = user_model.NewGhostUser()
- }
+ comment.Poster = getPoster(comment.PosterID, posterMaps)
}
return nil
}