@@ -578,17 +578,9 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
578578 // -------------------------------
579579 // Fill stats to post to ctx.Data.
580580 // -------------------------------
581- issueStats , err := getUserIssueStats (ctx , filterMode , issue_indexer .ToSearchOptions (keyword , opts ).Copy (
581+ issueStats , err := getUserIssueStats (ctx , ctxUser , filterMode , issue_indexer .ToSearchOptions (keyword , opts ).Copy (
582582 func (o * issue_indexer.SearchOptions ) {
583583 o .IsFuzzyKeyword = isFuzzy
584- // If the doer is the same as the context user, which means the doer is viewing his own dashboard,
585- // it's not enough to show the repos that the doer owns or has been explicitly granted access to,
586- // because the doer may create issues or be mentioned in any public repo.
587- // So we need search issues in all public repos.
588- o .AllPublic = ctx .Doer .ID == ctxUser .ID
589- o .MentionID = nil
590- o .ReviewRequestedID = nil
591- o .ReviewedID = nil
592584 },
593585 ))
594586 if err != nil {
@@ -777,10 +769,19 @@ func UsernameSubRoute(ctx *context.Context) {
777769 }
778770}
779771
780- func getUserIssueStats (ctx * context.Context , filterMode int , opts * issue_indexer.SearchOptions ) (ret * issues_model.IssueStats , err error ) {
772+ func getUserIssueStats (ctx * context.Context , ctxUser * user_model. User , filterMode int , opts * issue_indexer.SearchOptions ) (ret * issues_model.IssueStats , err error ) {
781773 ret = & issues_model.IssueStats {}
782774 doerID := ctx .Doer .ID
783775
776+ opts = opts .Copy (func (o * issue_indexer.SearchOptions ) {
777+ // If the doer is the same as the context user, which means the doer is viewing his own dashboard,
778+ // it's not enough to show the repos that the doer owns or has been explicitly granted access to,
779+ // because the doer may create issues or be mentioned in any public repo.
780+ // So we need search issues in all public repos.
781+ o .AllPublic = doerID == ctxUser .ID
782+ })
783+
784+ // Open/Closed are for the tabs of the issue list
784785 {
785786 openClosedOpts := opts .Copy ()
786787 switch filterMode {
@@ -811,6 +812,15 @@ func getUserIssueStats(ctx *context.Context, filterMode int, opts *issue_indexer
811812 }
812813 }
813814
815+ // Below stats are for the left sidebar
816+ opts = opts .Copy (func (o * issue_indexer.SearchOptions ) {
817+ o .AssigneeID = nil
818+ o .PosterID = nil
819+ o .MentionID = nil
820+ o .ReviewRequestedID = nil
821+ o .ReviewedID = nil
822+ })
823+
814824 ret .YourRepositoriesCount , err = issue_indexer .CountIssues (ctx , opts .Copy (func (o * issue_indexer.SearchOptions ) { o .AllPublic = false }))
815825 if err != nil {
816826 return nil , err
0 commit comments