Skip to content

Commit 8a1baf6

Browse files
committed
Performance optimization for pull request files loading comments attachments
1 parent d88b012 commit 8a1baf6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

routers/web/repo/pull.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,9 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
787787
for _, file := range diff.Files {
788788
for _, section := range file.Sections {
789789
for _, line := range section.Lines {
790-
for _, comment := range line.Comments {
791-
if err := comment.LoadAttachments(ctx); err != nil {
792-
ctx.ServerError("LoadAttachments", err)
793-
return
794-
}
790+
if err := line.Comments.LoadAttachments(ctx); err != nil {
791+
ctx.ServerError("LoadAttachments", err)
792+
return
795793
}
796794
}
797795
}

services/gitdiff/gitdiff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type DiffLine struct {
8080
Match int
8181
Type DiffLineType
8282
Content string
83-
Comments []*issues_model.Comment
83+
Comments issues_model.CommentList
8484
SectionInfo *DiffLineSectionInfo
8585
}
8686

0 commit comments

Comments
 (0)