@@ -576,17 +576,9 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
576576 // -------------------------------
577577 // Fill stats to post to ctx.Data.
578578 // -------------------------------
579- issueStats , err := getUserIssueStats (ctx , filterMode , issue_indexer .ToSearchOptions (keyword , opts ).Copy (
579+ issueStats , err := getUserIssueStats (ctx , ctxUser , filterMode , issue_indexer .ToSearchOptions (keyword , opts ).Copy (
580580 func (o * issue_indexer.SearchOptions ) {
581581 o .IsFuzzyKeyword = isFuzzy
582- // If the doer is the same as the context user, which means the doer is viewing his own dashboard,
583- // it's not enough to show the repos that the doer owns or has been explicitly granted access to,
584- // because the doer may create issues or be mentioned in any public repo.
585- // So we need search issues in all public repos.
586- o .AllPublic = ctx .Doer .ID == ctxUser .ID
587- o .MentionID = nil
588- o .ReviewRequestedID = nil
589- o .ReviewedID = nil
590582 },
591583 ))
592584 if err != nil {
@@ -775,10 +767,19 @@ func UsernameSubRoute(ctx *context.Context) {
775767 }
776768}
777769
778- func getUserIssueStats (ctx * context.Context , filterMode int , opts * issue_indexer.SearchOptions ) (ret * issues_model.IssueStats , err error ) {
770+ func getUserIssueStats (ctx * context.Context , ctxUser * user_model. User , filterMode int , opts * issue_indexer.SearchOptions ) (ret * issues_model.IssueStats , err error ) {
779771 ret = & issues_model.IssueStats {}
780772 doerID := ctx .Doer .ID
781773
774+ opts = opts .Copy (func (o * issue_indexer.SearchOptions ) {
775+ // If the doer is the same as the context user, which means the doer is viewing his own dashboard,
776+ // it's not enough to show the repos that the doer owns or has been explicitly granted access to,
777+ // because the doer may create issues or be mentioned in any public repo.
778+ // So we need search issues in all public repos.
779+ o .AllPublic = doerID == ctxUser .ID
780+ })
781+
782+ // Open/Closed are for the tabs of the issue list
782783 {
783784 openClosedOpts := opts .Copy ()
784785 switch filterMode {
@@ -809,6 +810,15 @@ func getUserIssueStats(ctx *context.Context, filterMode int, opts *issue_indexer
809810 }
810811 }
811812
813+ // Below stats are for the left sidebar
814+ opts = opts .Copy (func (o * issue_indexer.SearchOptions ) {
815+ o .AssigneeID = nil
816+ o .PosterID = nil
817+ o .MentionID = nil
818+ o .ReviewRequestedID = nil
819+ o .ReviewedID = nil
820+ })
821+
812822 ret .YourRepositoriesCount , err = issue_indexer .CountIssues (ctx , opts .Copy (func (o * issue_indexer.SearchOptions ) { o .AllPublic = false }))
813823 if err != nil {
814824 return nil , err
0 commit comments