From 528757b90ff95bf49493d8fbb304f7d3885c715f Mon Sep 17 00:00:00 2001 From: Chris Pickett Date: Sat, 13 Aug 2022 14:27:49 -0500 Subject: [PATCH 1/2] Use the total issue count for UI 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routers/web/user/home.go b/routers/web/user/home.go index f338c525b4d3e..fdc0c234b2a0a 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -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 @@ -618,6 +616,14 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { shownIssues += int(issueCountByRepo[repoID]) } } + ctx.Data["TotalShownIssueCount"] = shownIssues + + var allIssueCount int64 + for _, issueCount := range issueCountByRepo { + allIssueCount += issueCount + } + ctx.Data["TotalIssueCount"] = allIssueCount + if len(repoIDs) == 1 { repo := showReposMap[repoIDs[0]] if repo != nil { From bbf8f99bd8cead8e4cb733b62a189883e226aa26 Mon Sep 17 00:00:00 2001 From: Chris Pickett Date: Mon, 15 Aug 2022 08:12:49 -0500 Subject: [PATCH 2/2] Remove unused context variable --- routers/web/user/home.go | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/web/user/home.go b/routers/web/user/home.go index fdc0c234b2a0a..5e17239e348ce 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -616,7 +616,6 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { shownIssues += int(issueCountByRepo[repoID]) } } - ctx.Data["TotalShownIssueCount"] = shownIssues var allIssueCount int64 for _, issueCount := range issueCountByRepo {