]> source.dussan.org Git - gitea.git/commitdiff
Use the total issue count for UI (#20785) (#20827)
authorparnic <chris@perniciousgames.com>
Wed, 17 Aug 2022 17:25:07 +0000 (12:25 -0500)
committerGitHub <noreply@github.com>
Wed, 17 Aug 2022 17:25:07 +0000 (13:25 -0400)
Backport #20785

This fixes a problem where the "All" line item on the Issues or Pull Requests page was only showing the count of the selected repos instead of the total of all issues/prs in all repos.

The "total number of shown issues" number is now stashed in a different context variable in case it wants to be used by the frontend later. It's currently not being used.

Fixes #20574

routers/web/user/home.go

index 648269980472e9841f558a5e1d1deda6a80edffb..1c93972b9de14889a5a5c353c88d0c85f37604ad 100644 (file)
@@ -607,10 +607,8 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
        var shownIssues int
        if !isShowClosed {
                shownIssues = int(issueStats.OpenCount)
-               ctx.Data["TotalIssueCount"] = shownIssues
        } else {
                shownIssues = int(issueStats.ClosedCount)
-               ctx.Data["TotalIssueCount"] = shownIssues
        }
        if len(repoIDs) != 0 {
                shownIssues = 0
@@ -619,6 +617,12 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
                }
        }
 
+       var allIssueCount int64
+       for _, issueCount := range issueCountByRepo {
+               allIssueCount += issueCount
+       }
+       ctx.Data["TotalIssueCount"] = allIssueCount
+
        ctx.Data["IsShowClosed"] = isShowClosed
 
        ctx.Data["IssueRefEndNames"], ctx.Data["IssueRefURLs"] = issue_service.GetRefEndNamesAndURLs(issues, ctx.FormString("RepoLink"))