Skip to content

Commit 16980d1

Browse files
authored
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.
1 parent a6168fa commit 16980d1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

routers/repo/issue.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
139139
return
140140
}
141141
}
142-
isShowClosed := ctx.Query("state") == "closed"
143142

144143
keyword := strings.Trim(ctx.Query("q"), " ")
145144
if bytes.Contains([]byte(keyword), []byte{0x00}) {
@@ -177,6 +176,13 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
177176
return
178177
}
179178
}
179+
180+
isShowClosed := ctx.Query("state") == "closed"
181+
// if open issues are zero and close don't, use closed as default
182+
if len(ctx.Query("state")) == 0 && issueStats.OpenCount == 0 && issueStats.ClosedCount != 0 {
183+
isShowClosed = true
184+
}
185+
180186
page := ctx.QueryInt("page")
181187
if page <= 1 {
182188
page = 1

0 commit comments

Comments
 (0)