diff --git a/pkg/cmd/pr/shared/survey.go b/pkg/cmd/pr/shared/survey.go index 374d99f55..86b8f9021 100644 --- a/pkg/cmd/pr/shared/survey.go +++ b/pkg/cmd/pr/shared/survey.go @@ -231,22 +231,20 @@ func MetadataSurvey(p Prompt, io *iostreams.IOStreams, baseRepo ghrepo.Interface fmt.Fprintln(io.ErrOut, "warning: no available reviewers") } } - var mqs []*survey.Question if isChosen("Assignees") { if len(assignees) > 0 { - mqs = append(mqs, &survey.Question{ - Name: "assignees", - Prompt: &survey.MultiSelect{ - Message: "Assignees", - Options: assignees, - Default: state.Assignees, - Filter: prompter.LatinMatchingFilter, - }, - }) + selected, err := p.MultiSelect("Assignees", state.Assignees, assignees) + if err != nil { + return err + } + for _, i := range selected { + values.Assignees = append(values.Assignees, assignees[i]) + } } else { fmt.Fprintln(io.ErrOut, "warning: no assignable users") } } + var mqs []*survey.Question if isChosen("Labels") { if len(labels) > 0 { mqs = append(mqs, &survey.Question{ diff --git a/pkg/cmd/pr/shared/survey_test.go b/pkg/cmd/pr/shared/survey_test.go index 8f19540fc..790bbcd2e 100644 --- a/pkg/cmd/pr/shared/survey_test.go +++ b/pkg/cmd/pr/shared/survey_test.go @@ -52,6 +52,9 @@ func TestMetadataSurvey_selectAll(t *testing.T) { pm.RegisterMultiSelect("Reviewers", []string{}, []string{"hubot", "monalisa"}, func(_ string, _, _ []string) ([]int, error) { return []int{1}, nil }) + pm.RegisterMultiSelect("Assignees", []string{}, []string{"hubot", "monalisa"}, func(_ string, _, _ []string) ([]int, error) { + return []int{0}, nil + }) //nolint:staticcheck // SA1019: prompt.InitAskStubber is deprecated: use NewAskStubber as, restoreAsk := prompt.InitAskStubber() @@ -59,14 +62,6 @@ func TestMetadataSurvey_selectAll(t *testing.T) { //nolint:staticcheck // SA1019: as.Stub is deprecated: use StubPrompt as.Stub([]*prompt.QuestionStub{ - //{ - // Name: "reviewers", - // Value: []string{"monalisa"}, - //}, - { - Name: "assignees", - Value: []string{"hubot"}, - }, { Name: "labels", Value: []string{"good first issue"},