Skip to content

Commit

Permalink
Use the total issue count for UI
Browse files Browse the repository at this point in the history
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 go-gitea#20574
  • Loading branch information
parnic committed Aug 13, 2022
1 parent 99efa02 commit 528757b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions routers/web/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,17 +607,23 @@ 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
for _, repoID := range repoIDs {
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 {
Expand Down

0 comments on commit 528757b

Please sign in to comment.