@@ -576,17 +576,9 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
576
576
// -------------------------------
577
577
// Fill stats to post to ctx.Data.
578
578
// -------------------------------
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 (
580
580
func (o * issue_indexer.SearchOptions ) {
581
581
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
590
582
},
591
583
))
592
584
if err != nil {
@@ -775,10 +767,19 @@ func UsernameSubRoute(ctx *context.Context) {
775
767
}
776
768
}
777
769
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 ) {
779
771
ret = & issues_model.IssueStats {}
780
772
doerID := ctx .Doer .ID
781
773
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
782
783
{
783
784
openClosedOpts := opts .Copy ()
784
785
switch filterMode {
@@ -809,6 +810,15 @@ func getUserIssueStats(ctx *context.Context, filterMode int, opts *issue_indexer
809
810
}
810
811
}
811
812
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
+
812
822
ret .YourRepositoriesCount , err = issue_indexer .CountIssues (ctx , opts .Copy (func (o * issue_indexer.SearchOptions ) { o .AllPublic = false }))
813
823
if err != nil {
814
824
return nil , err
0 commit comments