aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/pull.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2025-02-13 22:49:58 -0800
committerGitHub <noreply@github.com>2025-02-14 06:49:58 +0000
commitf232d8f5309fbf316e297cb7c04eb431f2c7ae24 (patch)
treeac3f94823319609d42cf6997f8c17eba778e2d34 /routers/web/repo/pull.go
parentb426e383fe1a75680a0ebc349e7c939aa438e8db (diff)
downloadgitea-f232d8f5309fbf316e297cb7c04eb431f2c7ae24.tar.gz
gitea-f232d8f5309fbf316e297cb7c04eb431f2c7ae24.zip
Performance optimization for pull request files loading comments attachments (#33585)
Diffstat (limited to 'routers/web/repo/pull.go')
-rw-r--r--routers/web/repo/pull.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index e6fb492d6e..0c82736eef 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -784,18 +784,18 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
return
}
+ allComments := issues_model.CommentList{}
for _, file := range diff.Files {
for _, section := range file.Sections {
for _, line := range section.Lines {
- for _, comment := range line.Comments {
- if err := comment.LoadAttachments(ctx); err != nil {
- ctx.ServerError("LoadAttachments", err)
- return
- }
- }
+ allComments = append(allComments, line.Comments...)
}
}
}
+ if err := allComments.LoadAttachments(ctx); err != nil {
+ ctx.ServerError("LoadAttachments", err)
+ return
+ }
pb, err := git_model.GetFirstMatchProtectedBranchRule(ctx, pull.BaseRepoID, pull.BaseBranch)
if err != nil {