Skip to content

Commit

Permalink
default show closed actions list if all actions was closed (#24234)
Browse files Browse the repository at this point in the history
that's the same with issues and pull list
  • Loading branch information
a1012112796 authored Apr 25, 2023
1 parent 1ef43f9 commit 74aa446
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 74aa446

Please sign in to comment.