From b125b3e3aa6d3e09899127d9a72b3205b530bbe2 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Tue, 16 Apr 2024 11:54:20 +0200 Subject: [PATCH] Partial revert of "Refactor more filterslice (gitea#30370)" This reverts commit 44abf6ab4730e592931b863f90bcd873c774f226. --- models/issues/issue_list.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index d491d19a8..2235f3d3a 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -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 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 { - return issue.RepoID, true + repoIDs.Add(issue.RepoID) } 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