summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2025-01-10 07:00:06 +0100
committerEarl Warren <contact@earl-warren.org>2025-01-12 17:52:38 +0100
commitf2feb34927889a3e297274235c22238312f66002 (patch)
tree625df3907d75919e09b1cd30760df33407545ce4
parentFix fuzz test (#33156) (diff)
downloadforgejo-f2feb34927889a3e297274235c22238312f66002.tar.xz
forgejo-f2feb34927889a3e297274235c22238312f66002.zip
chore(performance): loadCommentsByType sets Issues
Keep the setting of comment.Issues from the refactor. It is cheap and potentially saves loading the issue again. Former title: Some small refactors (#33144) (cherry picked from commit d3083d21981f9445cf7570956a1fdedfc8578b56) Conflicts: models/issues/comment_list.go models/issues/issue_list.go routers/web/repo/issue_view.go
-rw-r--r--models/issues/issue.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/issues/issue.go b/models/issues/issue.go
index fbbc4828a2..1e969790d7 100644
--- a/models/issues/issue.go
+++ b/models/issues/issue.go
@@ -268,6 +268,9 @@ func (issue *Issue) loadCommentsByType(ctx context.Context, tp CommentType) (err
IssueID: issue.ID,
Type: tp,
})
+ for _, comment := range issue.Comments {
+ comment.Issue = issue
+ }
return err
}