MCPcopy Index your code
hub / github.com/cli/cli / AssigneeLogins

Method AssigneeLogins

pkg/cmd/pr/shared/editable.go:155–182  ·  view source on GitHub ↗

AssigneeLogins computes the final list of assignee logins from the current defaults plus any Add/Remove operations. Unlike AssigneeIds, this does not resolve logins to node IDs, and is used on github.com where the ReplaceActorsForAssignable mutation accepts logins directly.

(client *api.Client, repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

153// resolve logins to node IDs, and is used on github.com where the
154// ReplaceActorsForAssignable mutation accepts logins directly.
155func (e Editable) AssigneeLogins(client *api.Client, repo ghrepo.Interface) ([]string, error) {
156 if !e.Assignees.Edited {
157 return nil, nil
158 }
159
160 if len(e.Assignees.Add) != 0 || len(e.Assignees.Remove) != 0 {
161 replacer := NewSpecialAssigneeReplacer(client, repo.RepoHost(), true, true)
162
163 assigneeSet := set.NewStringSet()
164 assigneeSet.AddValues(e.Assignees.DefaultLogins)
165
166 add, err := replacer.ReplaceSlice(e.Assignees.Add)
167 if err != nil {
168 return nil, err
169 }
170 assigneeSet.AddValues(add)
171
172 remove, err := replacer.ReplaceSlice(e.Assignees.Remove)
173 if err != nil {
174 return nil, err
175 }
176 assigneeSet.RemoveValues(remove)
177
178 e.Assignees.Value = assigneeSet.ToSlice()
179 }
180
181 return e.Assignees.Value, nil
182}
183
184// SpecialAssigneeReplacer expands special assignee names (@me, Copilot actors)
185// in login slices. Use NewSpecialAssigneeReplacer to create one.

Callers 1

UpdateIssueFunction · 0.80

Calls 7

ReplaceSliceMethod · 0.95
NewStringSetFunction · 0.92
AddValuesMethod · 0.80
RemoveValuesMethod · 0.80
RepoHostMethod · 0.65
ToSliceMethod · 0.65

Tested by

no test coverage detected