feat(issue edit): replacing actor assignee is done synchronously with updateIssue

This commit is contained in:
Kynan Ware 2025-05-14 11:43:29 -06:00
parent 712eeabd4a
commit 08cd1dc7db
2 changed files with 17 additions and 20 deletions

View file

@ -574,14 +574,6 @@ func Test_editRun(t *testing.T) {
{ "errors": [ { "message": "test error" } ] }`,
func(inputs map[string]interface{}) {}),
)
reg.Register(
httpmock.GraphQLMutationMatcher(`mutation IssueUpdate\b`, func(m map[string]interface{}) bool {
return m["id"] == "456"
}),
httpmock.GraphQLMutation(`
{ "errors": [ { "message": "test error" } ] }`,
func(inputs map[string]interface{}) {}),
)
},
stdout: heredoc.Doc(`
https://github.com/OWNER/REPO/issue/123

View file

@ -58,23 +58,28 @@ func UpdateIssue(httpClient *http.Client, repo ghrepo.Interface, id string, isPR
})
}
// updateIssue mutation does not support Actors so assignment needs to
// be in a separate request when our assignees are Actors.
if options.Assignees.Edited && options.Assignees.ActorAssignees {
if dirtyExcludingLabels(options) {
wg.Go(func() error {
apiClient := api.NewClientFromHTTP(httpClient)
assigneeIds, err := options.AssigneeIds(apiClient, repo)
// updateIssue mutation does not support Actors so assignment needs to
// be in a separate request when our assignees are Actors.
if options.Assignees.Edited && options.Assignees.ActorAssignees {
apiClient := api.NewClientFromHTTP(httpClient)
assigneeIds, err := options.AssigneeIds(apiClient, repo)
if err != nil {
return err
}
err = replaceActorAssigneesForEditable(apiClient, repo, id, assigneeIds)
if err != nil {
return err
}
}
err := replaceIssueFields(httpClient, repo, id, isPR, options)
if err != nil {
return err
}
return replaceActorAssigneesForEditable(apiClient, repo, id, assigneeIds)
})
}
if dirtyExcludingLabels(options) {
wg.Go(func() error {
return replaceIssueFields(httpClient, repo, id, isPR, options)
return nil
})
}