@@ -454,10 +454,21 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
454454 AllPublic : false ,
455455 AllLimited : false ,
456456 }
457-
458457 if team != nil {
459458 repoOpts .TeamID = team .ID
460459 }
460+ {
461+ ids , _ , err := repo_model .SearchRepositoryIDs (repoOpts )
462+ if err != nil {
463+ ctx .ServerError ("SearchRepositoryIDs" , err )
464+ return
465+ }
466+ opts .RepoIDs = ids
467+ if len (opts .RepoIDs ) == 0 {
468+ // no repos found, don't let the indexer return all repos
469+ opts .RepoIDs = []int64 {0 }
470+ }
471+ }
461472
462473 switch filterMode {
463474 case issues_model .FilterModeAll :
@@ -541,15 +552,13 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
541552 // Parse ctx.FormString("repos") and remember matched repo IDs for later.
542553 // Gets set when clicking filters on the issues overview page.
543554 repoIDs := getRepoIDs (ctx .FormString ("repos" ))
544- if len (repoIDs ) == 0 {
545- repoIDs = accessibleRepos .Values ()
546- } else {
555+ if len (repoIDs ) > 0 {
547556 // Remove repo IDs that are not accessible to the user.
548557 repoIDs = util .SliceRemoveAllFunc (repoIDs , func (v int64 ) bool {
549558 return ! accessibleRepos .Contains (v )
550559 })
560+ opts .RepoIDs = repoIDs
551561 }
552- opts .RepoIDs = repoIDs
553562
554563 // ------------------------------
555564 // Get issues as defined by opts.
@@ -609,6 +618,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
609618 var issueStats * issues_model.IssueStats
610619 {
611620 statsOpts := issues_model.IssuesOptions {
621+ RepoIDs : repoIDs ,
612622 User : ctx .Doer ,
613623 IsPull : util .OptionalBoolOf (isPullList ),
614624 IsClosed : util .OptionalBoolOf (isShowClosed ),
0 commit comments