1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Performance improvement for list pull requests (#15447) (#15500)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
6543
2021-04-16 00:14:14 +02:00
committed by GitHub
parent 9dc76b2036
commit 92c91d7d8b
5 changed files with 73 additions and 30 deletions

View File

@@ -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) {