diff options
author | parnic <chris@perniciousgames.com> | 2022-08-17 08:13:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 21:13:41 +0800 |
commit | 7503cd35c285741c6d9caf9797a5c953ae9dccf6 (patch) | |
tree | 21d85f3465a66161348dcedcee584edea92d9807 /routers | |
parent | a4e91c4197483c94f13e623c962b6b011494e949 (diff) | |
download | gitea-7503cd35c285741c6d9caf9797a5c953ae9dccf6.tar.gz gitea-7503cd35c285741c6d9caf9797a5c953ae9dccf6.zip |
Use the total issue count for UI (#20785)
* 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
* Remove unused context variable
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/user/home.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go index f338c525b4..5e17239e34 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,13 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { shownIssues += int(issueCountByRepo[repoID]) } } + + var allIssueCount int64 + for _, issueCount := range issueCountByRepo { + allIssueCount += issueCount + } + ctx.Data["TotalIssueCount"] = allIssueCount + if len(repoIDs) == 1 { repo := showReposMap[repoIDs[0]] if repo != nil { |