diff --git a/src/controllers/GitlabController.js b/src/controllers/GitlabController.js index 5434b11..8c60f23 100644 --- a/src/controllers/GitlabController.js +++ b/src/controllers/GitlabController.js @@ -263,7 +263,7 @@ async function deleteUsersFromTeam(req, res) { // If groupInDB not exists, then just return if (groupInDB) { try { - const ownerUser = await helper.queryOneUserByTypeAndRole(User, + const ownerUser = await dbHelper.queryOneUserByTypeAndRole(User, groupInDB.ownerUsername, constants.USER_TYPES.GITLAB, constants.USER_ROLES.OWNER); if (!ownerUser) { throw new errors.NotFoundError('The owner user is not found or not accessible.'); diff --git a/src/services/ProjectService.js b/src/services/ProjectService.js index 050d3a8..bc702c2 100644 --- a/src/services/ProjectService.js +++ b/src/services/ProjectService.js @@ -150,8 +150,11 @@ async function _createOrMigrateRepository(repoUrl, project, currentUser) { await dbHelper.update(models.Repository, oldRepo.id, {projectId: project.id, archived: false}); await Promise.all(issueIds.map(issueId => dbHelper.update(models.Issue, issueId, {projectId: project.id}))); await Promise.all( - paymentIds.map(paymentId => dbHelper.update(models.CopilotPayment, paymentId, {project: project.id})) + paymentIds.filter(paymentId => paymentId) + .map(paymentId => dbHelper.update(models.CopilotPayment, paymentId, {project: project.id})) ); + + await createHook({projectId: project.id}, currentUser, repoUrl); } catch (err) { throw new Error(`Update ProjectId for Repository, Issue, CopilotPayment failed. Repo ${repoUrl}. Internal Error: ${err}`);