diff --git a/pkg/cmd/issue/edit/edit.go b/pkg/cmd/issue/edit/edit.go index b207a96fd..46ab37ebc 100644 --- a/pkg/cmd/issue/edit/edit.go +++ b/pkg/cmd/issue/edit/edit.go @@ -30,7 +30,7 @@ type EditOptions struct { DetermineEditor func() (string, error) FieldsToEditSurvey func(prShared.EditPrompter, *prShared.Editable) error EditFieldsSurvey func(prShared.EditPrompter, *prShared.Editable, string) error - FetchOptions func(*api.Client, ghrepo.Interface, *prShared.Editable) error + FetchOptions func(*api.Client, ghrepo.Interface, *prShared.Editable, gh.ProjectsV1Support) error IssueNumbers []int Interactive bool @@ -248,7 +248,7 @@ func editRun(opts *EditOptions) error { // Fetch editable shared fields once for all issues. apiClient := api.NewClientFromHTTP(httpClient) opts.IO.StartProgressIndicatorWithLabel("Fetching repository information") - err = opts.FetchOptions(apiClient, baseRepo, &editable) + err = opts.FetchOptions(apiClient, baseRepo, &editable, opts.Detector.ProjectsV1()) opts.IO.StopProgressIndicator() if err != nil { return err diff --git a/pkg/cmd/pr/edit/edit.go b/pkg/cmd/pr/edit/edit.go index e593b791a..11cb74b1f 100644 --- a/pkg/cmd/pr/edit/edit.go +++ b/pkg/cmd/pr/edit/edit.go @@ -293,7 +293,7 @@ func editRun(opts *EditOptions) error { apiClient := api.NewClientFromHTTP(httpClient) opts.IO.StartProgressIndicator() - err = opts.Fetcher.EditableOptionsFetch(apiClient, repo, &editable) + err = opts.Fetcher.EditableOptionsFetch(apiClient, repo, &editable, opts.Detector.ProjectsV1()) opts.IO.StopProgressIndicator() if err != nil { return err @@ -398,13 +398,13 @@ func (s surveyor) EditFields(editable *shared.Editable, editorCmd string) error } type EditableOptionsFetcher interface { - EditableOptionsFetch(*api.Client, ghrepo.Interface, *shared.Editable) error + EditableOptionsFetch(*api.Client, ghrepo.Interface, *shared.Editable, gh.ProjectsV1Support) error } type fetcher struct{} -func (f fetcher) EditableOptionsFetch(client *api.Client, repo ghrepo.Interface, opts *shared.Editable) error { - return shared.FetchOptions(client, repo, opts) +func (f fetcher) EditableOptionsFetch(client *api.Client, repo ghrepo.Interface, opts *shared.Editable, projectsV1Support gh.ProjectsV1Support) error { + return shared.FetchOptions(client, repo, opts, projectsV1Support) } type EditorRetriever interface { diff --git a/pkg/cmd/pr/shared/editable.go b/pkg/cmd/pr/shared/editable.go index 7d0805a80..5cf55ad37 100644 --- a/pkg/cmd/pr/shared/editable.go +++ b/pkg/cmd/pr/shared/editable.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/cli/cli/v2/api" + "github.com/cli/cli/v2/internal/gh" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/set" ) @@ -395,7 +396,7 @@ func FieldsToEditSurvey(p EditPrompter, editable *Editable) error { return nil } -func FetchOptions(client *api.Client, repo ghrepo.Interface, editable *Editable) error { +func FetchOptions(client *api.Client, repo ghrepo.Interface, editable *Editable, projectV1Support gh.ProjectsV1Support) error { // Determine whether to fetch organization teams. // Interactive reviewer editing (Edited true, but no Add/Remove slices) still needs // team data for selection UI. For non-interactive flows, we never need to fetch teams. @@ -413,7 +414,7 @@ func FetchOptions(client *api.Client, repo ghrepo.Interface, editable *Editable) Assignees: editable.Assignees.Edited, ActorAssignees: editable.Assignees.ActorAssignees, Labels: editable.Labels.Edited, - ProjectsV1: editable.Projects.Edited, + ProjectsV1: editable.Projects.Edited && projectV1Support == gh.ProjectsV1Supported, ProjectsV2: editable.Projects.Edited, Milestones: editable.Milestone.Edited, }