diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2024-06-02 04:32:20 +0200 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-06-02 16:26:54 +0200 |
commit | 737c3e90eb0838bd14ad236d27400b3748684810 (patch) | |
tree | 624467450916c76ae520a1bee4ca32cb5e05bbe7 /models/issues | |
parent | Performance improvements for pull request list API (#30490) (diff) | |
download | forgejo-737c3e90eb0838bd14ad236d27400b3748684810.tar.xz forgejo-737c3e90eb0838bd14ad236d27400b3748684810.zip |
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)
Diffstat (limited to 'models/issues')
-rw-r--r-- | models/issues/comment_list.go | 4 | ||||
-rw-r--r-- | models/issues/issue_list.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/models/issues/comment_list.go b/models/issues/comment_list.go index 6b4ad80eed..61ac1c8f56 100644 --- a/models/issues/comment_list.go +++ b/models/issues/comment_list.go @@ -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 } diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index ea6753c6f5..fbfa7584a0 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -88,7 +88,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 } |