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)
| 153 | // resolve logins to node IDs, and is used on github.com where the |
| 154 | // ReplaceActorsForAssignable mutation accepts logins directly. |
| 155 | func (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. |
no test coverage detected