aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2024-06-02 04:32:20 +0200
committerGitHub <noreply@github.com>2024-06-02 10:32:20 +0800
commit3cc7f763c3c22ae4c3b5331f8b72b7009c5b11ea (patch)
tree76a7a1e613faa8104b190fe994491373d4149228 /models
parentab458ce10be59669c810ba43af41f2ba2e72ea5b (diff)
downloadgitea-3cc7f763c3c22ae4c3b5331f8b72b7009c5b11ea.tar.gz
gitea-3cc7f763c3c22ae4c3b5331f8b72b7009c5b11ea.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.
Diffstat (limited to 'models')
-rw-r--r--models/issues/comment_list.go4
-rw-r--r--models/issues/issue_list.go4
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 0dd37a04df..2c007c72ec 100644
--- a/models/issues/issue_list.go
+++ b/models/issues/issue_list.go
@@ -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
}