Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit a2cf911

Browse files
committed
Merge branch 'develop' of github.com:topcoder-platform/topcoder-x-processor into develop
2 parents d079e1f + 91469cb commit a2cf911

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

services/GithubService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ async function getUserIdByLogin(copilot, login) {
221221
Joi.attempt({copilot, login}, getUserIdByLogin.schema);
222222
const github = await _authenticate(copilot.accessToken);
223223
const user = await github.users.getForUser({username: login});
224-
return user.length ? user.id : null;
224+
return user.data ? user.data.id : null;
225225
}
226226

227227
getUserIdByLogin.schema = {

services/IssueService.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ async function handleIssueAssignment(event, issue, force = false) {
211211
return;
212212
}
213213

214+
// The issue has registered assignee. Ignore it.
215+
// If there is assignee changes, it will be handled at handleIssueUnassignment and this func will be called again.
216+
if (dbIssue.assignee) {
217+
return;
218+
}
219+
214220
// ensure issue has open for pickup label
215221
const hasOpenForPickupLabel = _(issue.labels).includes(config.OPEN_FOR_PICKUP_ISSUE_LABEL); // eslint-disable-line lodash/chaining
216222
const hasNotReadyLabel = _(issue.labels).includes(config.NOT_READY_ISSUE_LABEL); // eslint-disable-line lodash/chaining
@@ -675,7 +681,7 @@ async function handleIssueUnAssignment(event, issue) {
675681
}
676682

677683
if (dbIssue.assignee) {
678-
const assigneeUserId = gitHelper.getUserIdByLogin(event, dbIssue.assignee);
684+
const assigneeUserId = await gitHelper.getUserIdByLogin(event, dbIssue.assignee);
679685
if (!assigneeUserId) {
680686
// The assignement of this user was failed and broken.
681687
// We don't need to handle the unassignment.

utils/git-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class GitHelper {
149149
*/
150150
async getUserIdByLogin(event, assignee) {
151151
if (event.provider === 'github') {
152-
return gitHubService.getUserIdByLogin(event.copilot, assignee);
152+
return await gitHubService.getUserIdByLogin(event.copilot, assignee);
153153
}
154154
return gitlabService.getUserIdByLogin(event.copilot, assignee);
155155
}

0 commit comments

Comments
 (0)