| 753 | } |
| 754 | |
| 755 | func (m *RepoMetadataResult) MembersToIDs(names []string) ([]string, error) { |
| 756 | var ids []string |
| 757 | for _, assigneeLogin := range names { |
| 758 | found := false |
| 759 | for _, u := range m.AssignableUsers { |
| 760 | if strings.EqualFold(assigneeLogin, u.Login()) { |
| 761 | ids = append(ids, u.ID()) |
| 762 | found = true |
| 763 | break |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | // Look for ID in assignable actors if not found in assignable users |
| 768 | if !found { |
| 769 | for _, a := range m.AssignableActors { |
| 770 | if strings.EqualFold(assigneeLogin, a.Login()) { |
| 771 | ids = append(ids, a.ID()) |
| 772 | found = true |
| 773 | break |
| 774 | } |
| 775 | if strings.EqualFold(assigneeLogin, a.DisplayName()) { |
| 776 | ids = append(ids, a.ID()) |
| 777 | found = true |
| 778 | break |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | // And if we still didn't find an ID, return an error |
| 784 | if !found { |
| 785 | return nil, fmt.Errorf("'%s' not found", assigneeLogin) |
| 786 | } |
| 787 | } |
| 788 | return ids, nil |
| 789 | } |
| 790 | |
| 791 | func (m *RepoMetadataResult) TeamsToIDs(names []string) ([]string, error) { |
| 792 | var ids []string |