Skip to content

Commit 3cc7f76

Browse files
authored
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.
1 parent ab458ce commit 3cc7f76

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

models/issues/comment_list.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ func (comments CommentList) LoadPosters(ctx context.Context) error {
3232
}
3333

3434
for _, comment := range comments {
35-
comment.Poster = getPoster(comment.PosterID, posterMaps)
35+
if comment.Poster == nil {
36+
comment.Poster = getPoster(comment.PosterID, posterMaps)
37+
}
3638
}
3739
return nil
3840
}

models/issues/issue_list.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ func (issues IssueList) LoadPosters(ctx context.Context) error {
8787
}
8888

8989
for _, issue := range issues {
90-
issue.Poster = getPoster(issue.PosterID, posterMaps)
90+
if issue.Poster == nil {
91+
issue.Poster = getPoster(issue.PosterID, posterMaps)
92+
}
9193
}
9294
return nil
9395
}

0 commit comments

Comments
 (0)