Browse Source

Only update poster in issue/comment list if it has been loaded (#31216)

Previously, all posters were updated, even if they were not part of
posterMaps. In that case, a ghost user was erroneously inserted.

Fixes #31213.
pull/31221/head
Max Wipfli 2 years ago committed by GitHub
parent
commit
3cc7f763c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      models/issues/comment_list.go
  2. 4
      models/issues/issue_list.go

4
models/issues/comment_list.go

@ -32,7 +32,9 @@ func (comments CommentList) LoadPosters(ctx context.Context) error { @@ -32,7 +32,9 @@ func (comments CommentList) LoadPosters(ctx context.Context) error {
}
for _, comment := range comments {
comment.Poster = getPoster(comment.PosterID, posterMaps)
if comment.Poster == nil {
comment.Poster = getPoster(comment.PosterID, posterMaps)
}
}
return nil
}

4
models/issues/issue_list.go

@ -87,7 +87,9 @@ func (issues IssueList) LoadPosters(ctx context.Context) error { @@ -87,7 +87,9 @@ func (issues IssueList) LoadPosters(ctx context.Context) error {
}
for _, issue := range issues {
issue.Poster = getPoster(issue.PosterID, posterMaps)
if issue.Poster == nil {
issue.Poster = getPoster(issue.PosterID, posterMaps)
}
}
return nil
}

Loading…
Cancel
Save