Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default show closed actions list if all actions was closed #24234

Merged
merged 8 commits into from
Apr 25, 2023
8 changes: 7 additions & 1 deletion routers/web/repo/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,18 @@ func List(ctx *context.Context) {
ctx.Data["NumClosedActionRuns"] = numClosedRuns

opts.IsClosed = util.OptionalBoolNone
if ctx.FormString("state") == "closed" {
isShowClosed := ctx.FormString("state") == "closed"
if len(ctx.FormString("state")) == 0 && numOpenRuns == 0 && numClosedRuns != 0 {
isShowClosed = true
}

if isShowClosed {
opts.IsClosed = util.OptionalBoolTrue
ctx.Data["IsShowClosed"] = true
} else {
opts.IsClosed = util.OptionalBoolFalse
}

runs, total, err := actions_model.FindRuns(ctx, opts)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
Expand Down