default list of PR states should be empty (#210)

This commit is contained in:
Marko Gaćeša 2023-01-14 03:47:42 +01:00 committed by GitHub
parent bbae67299c
commit e5dc9754cd
2 changed files with 4 additions and 6 deletions

View File

@ -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,

View File

@ -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)