diff --git a/pkg/cmd/issue/edit/edit.go b/pkg/cmd/issue/edit/edit.go index 7c2306a63..668ece3a5 100644 --- a/pkg/cmd/issue/edit/edit.go +++ b/pkg/cmd/issue/edit/edit.go @@ -254,7 +254,7 @@ func editRun(opts *EditOptions) error { // Prompt the user which fields they'd like to edit. editable := opts.Editable - editable.IssueType.Allowed = true + editable.IssueType.Selectable = true if opts.Interactive { err = opts.FieldsToEditSurvey(opts.Prompter, &editable) if err != nil { diff --git a/pkg/cmd/issue/edit/edit_test.go b/pkg/cmd/issue/edit/edit_test.go index 9d1ea8a59..0d90a6dce 100644 --- a/pkg/cmd/issue/edit/edit_test.go +++ b/pkg/cmd/issue/edit/edit_test.go @@ -899,7 +899,7 @@ func Test_editRun(t *testing.T) { Interactive: true, FieldsToEditSurvey: func(_ prShared.EditPrompter, eo *prShared.Editable) error { // Verify the survey is allowed to offer Type as an option for issue edit. - assert.True(t, eo.IssueType.Allowed) + assert.True(t, eo.IssueType.Selectable) eo.IssueType.Edited = true return nil }, diff --git a/pkg/cmd/pr/edit/edit.go b/pkg/cmd/pr/edit/edit.go index 33a71154a..af5e04631 100644 --- a/pkg/cmd/pr/edit/edit.go +++ b/pkg/cmd/pr/edit/edit.go @@ -283,7 +283,7 @@ func editRun(opts *EditOptions) error { } editable := opts.Editable - editable.Reviewers.Allowed = true + editable.Reviewers.Selectable = true editable.Title.Default = pr.Title editable.Body.Default = pr.Body editable.Base.Default = pr.BaseRefName diff --git a/pkg/cmd/pr/shared/editable.go b/pkg/cmd/pr/shared/editable.go index 84fb8748c..404b0e0cc 100644 --- a/pkg/cmd/pr/shared/editable.go +++ b/pkg/cmd/pr/shared/editable.go @@ -38,7 +38,10 @@ type EditableString struct { Default string Options []string Edited bool - Allowed bool + // Selectable controls whether the interactive survey offers this + // field as one of the things the user can choose to edit. Flag-only + // fields leave it false. + Selectable bool } type EditableSlice struct { @@ -48,7 +51,10 @@ type EditableSlice struct { Default []string Options []string Edited bool - Allowed bool + // Selectable controls whether the interactive survey offers this + // field as one of the things the user can choose to edit. Flag-only + // fields leave it false. + Selectable bool } // EditableAssignees is a special case of EditableSlice. @@ -304,10 +310,10 @@ func (e *Editable) Clone() Editable { func (es *EditableString) clone() EditableString { return EditableString{ - Value: es.Value, - Default: es.Default, - Edited: es.Edited, - Allowed: es.Allowed, + Value: es.Value, + Default: es.Default, + Edited: es.Edited, + Selectable: es.Selectable, // Shallow copies since no mutation. Options: es.Options, } @@ -315,8 +321,8 @@ func (es *EditableString) clone() EditableString { func (es *EditableSlice) clone() EditableSlice { cpy := EditableSlice{ - Edited: es.Edited, - Allowed: es.Allowed, + Edited: es.Edited, + Selectable: es.Selectable, // Shallow copies since no mutation. Options: es.Options, // Copy mutable string slices. @@ -482,11 +488,11 @@ func FieldsToEditSurvey(p EditPrompter, editable *Editable) error { } opts := []string{"Title", "Body"} - if editable.Reviewers.Allowed { + if editable.Reviewers.Selectable { opts = append(opts, "Reviewers") } opts = append(opts, "Assignees", "Labels") - if editable.IssueType.Allowed { + if editable.IssueType.Selectable { opts = append(opts, "Type") } opts = append(opts, "Projects", "Milestone") diff --git a/pkg/cmd/pr/shared/survey_test.go b/pkg/cmd/pr/shared/survey_test.go index efe9785b0..fa0f7ae3b 100644 --- a/pkg/cmd/pr/shared/survey_test.go +++ b/pkg/cmd/pr/shared/survey_test.go @@ -287,7 +287,7 @@ func TestFieldsToEditSurvey_IssueOnlyFields(t *testing.T) { }) editable := &Editable{} - editable.IssueType.Allowed = true + editable.IssueType.Selectable = true err := FieldsToEditSurvey(pm, editable) require.NoError(t, err) assert.True(t, editable.IssueType.Edited)