diff --git a/pkg/cmd/issue/list/list_test.go b/pkg/cmd/issue/list/list_test.go index b3349081b..5d119ff25 100644 --- a/pkg/cmd/issue/list/list_test.go +++ b/pkg/cmd/issue/list/list_test.go @@ -217,7 +217,7 @@ func TestIssueList_web(t *testing.T) { assert.Equal(t, "", stdout.String()) assert.Equal(t, "Opening github.com/OWNER/REPO/issues in your browser.\n", stderr.String()) - browser.Verify(t, "https://github.com/OWNER/REPO/issues?q=assignee%3Apeter+author%3Ajohn+label%3Abug+label%3Adocs+mentions%3Afrank+milestone%3Av1.1+state%3Aall+type%3Aissue") + browser.Verify(t, "https://github.com/OWNER/REPO/issues?q=assignee%3Apeter+author%3Ajohn+label%3Abug+label%3Adocs+mentions%3Afrank+milestone%3Av1.1+type%3Aissue") } func Test_issueList(t *testing.T) { diff --git a/pkg/cmd/pr/list/list_test.go b/pkg/cmd/pr/list/list_test.go index cd52578a8..af750b20e 100644 --- a/pkg/cmd/pr/list/list_test.go +++ b/pkg/cmd/pr/list/list_test.go @@ -174,7 +174,7 @@ func TestPRList_filteringAssignee(t *testing.T) { http.Register( httpmock.GraphQL(`query PullRequestSearch\b`), httpmock.GraphQLQuery(`{}`, func(_ string, params map[string]interface{}) { - assert.Equal(t, `assignee:hubot base:develop label:"needs tests" repo:OWNER/REPO state:merged type:pr`, params["q"].(string)) + assert.Equal(t, `assignee:hubot base:develop is:merged label:"needs tests" repo:OWNER/REPO type:pr`, params["q"].(string)) })) _, err := runCommand(http, true, `-s merged -l "needs tests" -a hubot -B develop`) @@ -277,7 +277,7 @@ func TestPRList_web(t *testing.T) { { name: "filters", cli: "-a peter -l bug -l docs -L 10 -s merged -B trunk", - expectedBrowserURL: "https://github.com/OWNER/REPO/pulls?q=assignee%3Apeter+base%3Atrunk+label%3Abug+label%3Adocs+state%3Amerged+type%3Apr", + expectedBrowserURL: "https://github.com/OWNER/REPO/pulls?q=assignee%3Apeter+base%3Atrunk+is%3Amerged+label%3Abug+label%3Adocs+type%3Apr", }, { name: "draft", diff --git a/pkg/cmd/pr/shared/params.go b/pkg/cmd/pr/shared/params.go index 833b986d1..ed0813145 100644 --- a/pkg/cmd/pr/shared/params.go +++ b/pkg/cmd/pr/shared/params.go @@ -208,6 +208,13 @@ func ListURLWithQuery(listURL string, options FilterOptions) (string, error) { } func SearchQueryBuild(options FilterOptions) string { + var is, state string + switch options.State { + case "open", "closed": + state = options.State + case "merged": + is = "merged" + } q := search.Query{ Qualifiers: search.Qualifiers{ Assignee: options.Assignee, @@ -219,7 +226,8 @@ func SearchQueryBuild(options FilterOptions) string { Mentions: options.Mention, Milestone: options.Milestone, Repo: []string{options.Repo}, - State: options.State, + State: state, + Is: []string{is}, Type: options.Entity, }, }