summaryrefslogtreecommitdiffstats
path: root/models/issue_list.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-04-16 01:34:43 +0800
committerGitHub <noreply@github.com>2021-04-15 19:34:43 +0200
commit8202dd131189102d2531c853665d213e43a5c818 (patch)
tree33fdf41bb1387611a7014d2335ab620628200e82 /models/issue_list.go
parentf44543a1bb776fa8bdfd3b605d67197d1466eb20 (diff)
downloadgitea-8202dd131189102d2531c853665d213e43a5c818.tar.gz
gitea-8202dd131189102d2531c853665d213e43a5c818.zip
Performance improvement for list pull requests (#15447)
Diffstat (limited to 'models/issue_list.go')
-rw-r--r--models/issue_list.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/issue_list.go b/models/issue_list.go
index 0ac25fc690..87ad318dcf 100644
--- a/models/issue_list.go
+++ b/models/issue_list.go
@@ -53,6 +53,9 @@ func (issues IssueList) loadRepositories(e Engine) ([]*Repository, error) {
for _, issue := range issues {
issue.Repo = repoMaps[issue.RepoID]
+ if issue.PullRequest != nil {
+ issue.PullRequest.BaseRepo = issue.Repo
+ }
}
return valuesRepository(repoMaps), nil
}
@@ -516,6 +519,11 @@ func (issues IssueList) LoadDiscussComments() error {
return issues.loadComments(x, builder.Eq{"comment.type": CommentTypeComment})
}
+// LoadPullRequests loads pull requests
+func (issues IssueList) LoadPullRequests() error {
+ return issues.loadPullRequests(x)
+}
+
// GetApprovalCounts returns a map of issue ID to slice of approval counts
// FIXME: only returns official counts due to double counting of non-official approvals
func (issues IssueList) GetApprovalCounts() (map[int64][]*ReviewCount, error) {