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. (cherry picked from commit 3cc7f763c3c22ae4c3b5331f8b72b7009c5b11ea)
This commit is contained in:
parent
47a2102694
commit
737c3e90eb
2 changed files with 6 additions and 2 deletions
|
@ -32,8 +32,10 @@ func (comments CommentList) LoadPosters(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, comment := range comments {
|
for _, comment := range comments {
|
||||||
|
if comment.Poster == nil {
|
||||||
comment.Poster = getPoster(comment.PosterID, posterMaps)
|
comment.Poster = getPoster(comment.PosterID, posterMaps)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,10 @@ func (issues IssueList) LoadPosters(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, issue := range issues {
|
for _, issue := range issues {
|
||||||
|
if issue.Poster == nil {
|
||||||
issue.Poster = getPoster(issue.PosterID, posterMaps)
|
issue.Poster = getPoster(issue.PosterID, posterMaps)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue