@@ -457,12 +457,14 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
457
457
if team != nil {
458
458
repoOpts .TeamID = team .ID
459
459
}
460
+ accessibleRepos := container.Set [int64 ]{}
460
461
{
461
462
ids , _ , err := repo_model .SearchRepositoryIDs (repoOpts )
462
463
if err != nil {
463
464
ctx .ServerError ("SearchRepositoryIDs" , err )
464
465
return
465
466
}
467
+ accessibleRepos .AddMultiple (ids ... )
466
468
opts .RepoIDs = ids
467
469
if len (opts .RepoIDs ) == 0 {
468
470
// no repos found, don't let the indexer return all repos
@@ -489,18 +491,6 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
489
491
keyword := strings .Trim (ctx .FormString ("q" ), " " )
490
492
ctx .Data ["Keyword" ] = keyword
491
493
492
- accessibleRepos := container.Set [int64 ]{}
493
- {
494
- ids , err := issues_model .GetRepoIDsForIssuesOptions (opts , ctxUser )
495
- if err != nil {
496
- ctx .ServerError ("GetRepoIDsForIssuesOptions" , err )
497
- return
498
- }
499
- for _ , id := range ids {
500
- accessibleRepos .Add (id )
501
- }
502
- }
503
-
504
494
// Educated guess: Do or don't show closed issues.
505
495
isShowClosed := ctx .FormString ("state" ) == "closed"
506
496
opts .IsClosed = util .OptionalBoolOf (isShowClosed )
@@ -539,13 +529,13 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
539
529
540
530
// Parse ctx.FormString("repos") and remember matched repo IDs for later.
541
531
// Gets set when clicking filters on the issues overview page.
542
- repoIDs := getRepoIDs (ctx .FormString ("repos" ))
543
- if len (repoIDs ) > 0 {
532
+ selectedRepoIDs := getRepoIDs (ctx .FormString ("repos" ))
533
+ if len (selectedRepoIDs ) > 0 {
544
534
// Remove repo IDs that are not accessible to the user.
545
- repoIDs = util .SliceRemoveAllFunc (repoIDs , func (v int64 ) bool {
535
+ selectedRepoIDs = util .SliceRemoveAllFunc (selectedRepoIDs , func (v int64 ) bool {
546
536
return ! accessibleRepos .Contains (v )
547
537
})
548
- opts .RepoIDs = repoIDs
538
+ opts .RepoIDs = selectedRepoIDs
549
539
}
550
540
551
541
// ------------------------------
@@ -676,7 +666,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
676
666
ctx .Data ["IssueStats" ] = issueStats
677
667
ctx .Data ["ViewType" ] = viewType
678
668
ctx .Data ["SortType" ] = sortType
679
- ctx .Data ["RepoIDs" ] = opts . RepoIDs
669
+ ctx .Data ["RepoIDs" ] = selectedRepoIDs
680
670
ctx .Data ["IsShowClosed" ] = isShowClosed
681
671
ctx .Data ["SelectLabels" ] = selectedLabels
682
672
0 commit comments