mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: VSTS - add reviewer once even if multiple teams (#1259)
Closes #1258
This commit is contained in:
parent
62fd3563a5
commit
560bf727c3
2 changed files with 11 additions and 4 deletions
|
@ -510,8 +510,13 @@ async function addReviewers(prNo, reviewers) {
|
|||
members.forEach(listMembers => {
|
||||
listMembers.forEach(m => {
|
||||
reviewers.forEach(r => {
|
||||
if (r === m.displayName || r === m.uniqueName) {
|
||||
ids.push({ id: m.id, name: r });
|
||||
if (
|
||||
r.toLowerCase() === m.displayName.toLowerCase() ||
|
||||
r.toLowerCase() === m.uniqueName.toLowerCase()
|
||||
) {
|
||||
if (ids.filter(c => c.id === m.id).length === 0) {
|
||||
ids.push({ id: m.id, name: r });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -676,10 +676,12 @@ describe('platform/vsts', () => {
|
|||
}));
|
||||
vstsApi.getCoreApi.mockImplementation(() => ({
|
||||
getTeams: jest.fn(() => [{ id: 3 }, { id: 4 }]),
|
||||
getTeamMembers: jest.fn(() => [{ displayName: 'jyc' }]),
|
||||
getTeamMembers: jest.fn(() => [
|
||||
{ displayName: 'jyc', uniqueName: 'jyc', id: 123 },
|
||||
]),
|
||||
}));
|
||||
await vsts.addReviewers(123, ['test@bonjour.fr', 'jyc']);
|
||||
expect(vstsApi.gitApi.mock.calls.length).toBe(5);
|
||||
expect(vstsApi.gitApi.mock.calls.length).toBe(4);
|
||||
});
|
||||
|
||||
// to become async?
|
||||
|
|
Loading…
Reference in a new issue