mirror of
https://github.com/harness/drone.git
synced 2025-05-19 02:20:03 +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.
|
// Merge merges the pull request.
|
||||||
//
|
//
|
||||||
//nolint:gocognit,funlen // no need to refactor
|
//nolint:gocognit // no need to refactor
|
||||||
func (c *Controller) Merge(
|
func (c *Controller) Merge(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
session *auth.Session,
|
session *auth.Session,
|
||||||
|
@ -35,16 +35,14 @@ func parsePullReqStates(r *http.Request) []enum.PullReqState {
|
|||||||
strStates := r.Form[QueryParamState]
|
strStates := r.Form[QueryParamState]
|
||||||
m := make(map[enum.PullReqState]struct{}) // use map to eliminate duplicates
|
m := make(map[enum.PullReqState]struct{}) // use map to eliminate duplicates
|
||||||
for _, s := range strStates {
|
for _, s := range strStates {
|
||||||
|
if s == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if state, ok := enum.PullReqState(s).Sanitize(); ok {
|
if state, ok := enum.PullReqState(s).Sanitize(); ok {
|
||||||
m[state] = struct{}{}
|
m[state] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m) == 0 {
|
|
||||||
all, _ := enum.GetAllPullReqStates()
|
|
||||||
return all // the default is all PRs
|
|
||||||
}
|
|
||||||
|
|
||||||
states := make([]enum.PullReqState, 0, len(m))
|
states := make([]enum.PullReqState, 0, len(m))
|
||||||
for s := range m {
|
for s := range m {
|
||||||
states = append(states, s)
|
states = append(states, s)
|
||||||
|
Loading…
Reference in New Issue
Block a user