summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-07-09 23:13:06 +0200
committerGitHub <noreply@github.com>2020-07-09 22:13:06 +0100
commit16980d13cea3442fcc6a8d327d2622320c26d2fe (patch)
tree08905314ba15a56a3dd80651bb9fc05b83f2cd21
parenta6168fa25d0a7dfee689e1bce940557fff70d392 (diff)
downloadgitea-16980d13cea3442fcc6a8d327d2622320c26d2fe.tar.gz
gitea-16980d13cea3442fcc6a8d327d2622320c26d2fe.zip
Default to showing closed Issues/PR list when there are only closed issues/PRs (#12200)
If all issues are closed, then set the default to show the closed issues.
-rw-r--r--routers/repo/issue.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 181ed59a8c..e3ba5692c4 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -139,7 +139,6 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
return
}
}
- isShowClosed := ctx.Query("state") == "closed"
keyword := strings.Trim(ctx.Query("q"), " ")
if bytes.Contains([]byte(keyword), []byte{0x00}) {
@@ -177,6 +176,13 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
return
}
}
+
+ isShowClosed := ctx.Query("state") == "closed"
+ // if open issues are zero and close don't, use closed as default
+ if len(ctx.Query("state")) == 0 && issueStats.OpenCount == 0 && issueStats.ClosedCount != 0 {
+ isShowClosed = true
+ }
+
page := ctx.QueryInt("page")
if page <= 1 {
page = 1