1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

Partial revert of "Refactor more filterslice (gitea#30370)"

This reverts commit 44abf6ab47.
This commit is contained in:
oliverpool 2024-04-16 11:54:20 +02:00
parent 2db6d5dae9
commit b125b3e3aa

View file

@ -21,15 +21,16 @@ type IssueList []*Issue
// get the repo IDs to be loaded later, these IDs are for issue.Repo and issue.PullRequest.HeadRepo // get the repo IDs to be loaded later, these IDs are for issue.Repo and issue.PullRequest.HeadRepo
func (issues IssueList) getRepoIDs() []int64 { func (issues IssueList) getRepoIDs() []int64 {
return container.FilterSlice(issues, func(issue *Issue) (int64, bool) { repoIDs := make(container.Set[int64], len(issues))
for _, issue := range issues {
if issue.Repo == nil { if issue.Repo == nil {
return issue.RepoID, true repoIDs.Add(issue.RepoID)
} }
if issue.PullRequest != nil && issue.PullRequest.HeadRepo == nil { if issue.PullRequest != nil && issue.PullRequest.HeadRepo == nil {
return issue.PullRequest.HeadRepoID, true repoIDs.Add(issue.PullRequest.HeadRepoID)
} }
return 0, false }
}) return repoIDs.Values()
} }
// LoadRepositories loads issues' all repositories // LoadRepositories loads issues' all repositories