Skip to content

Commit

Permalink
Default to showing closed Issues/PR list when there are only closed i…
Browse files Browse the repository at this point in the history
…ssues/PRs (#12200)

If all issues are closed, then set the default to show the closed issues.
  • Loading branch information
6543 authored Jul 9, 2020
1 parent a6168fa commit 16980d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion routers/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 16980d1

Please sign in to comment.