From 74aa44625bb0cef4430385f9e30e211dc02b55e9 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Tue, 25 Apr 2023 11:34:16 +0800 Subject: [PATCH] default show closed actions list if all actions was closed (#24234) that's the same with issues and pull list --- routers/web/repo/actions/actions.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go index fc7ac2d714..8a44e836c5 100644 --- a/routers/web/repo/actions/actions.go +++ b/routers/web/repo/actions/actions.go @@ -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())