From f2feb34927889a3e297274235c22238312f66002 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 9 Jan 2025 22:00:06 -0800 Subject: [PATCH] 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 --- models/issues/issue.go | 3 +++ 1 file changed, 3 insertions(+) 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 }