From e5dc9754cda2aab6d3fb20728edfe5f129b021c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Ga=C4=87e=C5=A1a?= Date: Sat, 14 Jan 2023 03:47:42 +0100 Subject: [PATCH] default list of PR states should be empty (#210) --- internal/api/controller/pullreq/merge.go | 2 +- internal/api/request/pullreq.go | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/api/controller/pullreq/merge.go b/internal/api/controller/pullreq/merge.go index 1a6758377..c8eda7ac0 100644 --- a/internal/api/controller/pullreq/merge.go +++ b/internal/api/controller/pullreq/merge.go @@ -29,7 +29,7 @@ type MergeInput struct { // Merge merges the pull request. // -//nolint:gocognit,funlen // no need to refactor +//nolint:gocognit // no need to refactor func (c *Controller) Merge( ctx context.Context, session *auth.Session, diff --git a/internal/api/request/pullreq.go b/internal/api/request/pullreq.go index 87f8b8708..c081c6d28 100644 --- a/internal/api/request/pullreq.go +++ b/internal/api/request/pullreq.go @@ -35,16 +35,14 @@ func parsePullReqStates(r *http.Request) []enum.PullReqState { strStates := r.Form[QueryParamState] m := make(map[enum.PullReqState]struct{}) // use map to eliminate duplicates for _, s := range strStates { + if s == "" { + continue + } if state, ok := enum.PullReqState(s).Sanitize(); ok { m[state] = struct{}{} } } - if len(m) == 0 { - all, _ := enum.GetAllPullReqStates() - return all // the default is all PRs - } - states := make([]enum.PullReqState, 0, len(m)) for s := range m { states = append(states, s)