Skip to content

Commit

Permalink
Only update poster in issue/comment list if it has been loaded (#31216)
Browse files Browse the repository at this point in the history
Previously, all posters were updated, even if they were not part of
posterMaps. In that case, a ghost user was erroneously inserted.

Fixes #31213.
  • Loading branch information
MaxWipfli authored Jun 2, 2024
1 parent ab458ce commit 3cc7f76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion models/issues/comment_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion models/issues/issue_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3cc7f76

Please sign in to comment.