mirror of
https://github.com/harness/drone.git
synced 2025-05-18 18:09:56 +08:00
default list of PR states should be empty (#210)
This commit is contained in:
parent
bbae67299c
commit
e5dc9754cd
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user