Skip to content

Commit 8218b87

Browse files
authored
Merge pull request #834 from topcoder-platform/pm-1497
fix(PM-1497): Add opportunity title and type in apply copilot email
2 parents 682c2b3 + cc15920 commit 8218b87

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ workflows:
149149
context : org-global
150150
filters:
151151
branches:
152-
only: ['develop', 'migration-setup', 'pm-1494_1']
152+
only: ['develop', 'migration-setup', 'pm-1497']
153153
- deployProd:
154154
context : org-global
155155
filters:

src/routes/copilotOpportunityApply/create.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import util from '../../util';
88
import { PERMISSION } from '../../permissions/constants';
99
import { CONNECT_NOTIFICATION_EVENT, COPILOT_OPPORTUNITY_STATUS, TEMPLATE_IDS, USER_ROLE } from '../../constants';
1010
import { createEvent } from '../../services/busApi';
11+
import { getCopilotTypeLabel } from '../../utils/copilot';
1112

1213
const applyCopilotRequestValidations = {
1314
body: Joi.object().keys({
@@ -41,6 +42,12 @@ module.exports = [
4142
where: {
4243
id: copilotOpportunityId,
4344
},
45+
include: [
46+
{
47+
model: models.CopilotRequest,
48+
as: 'copilotRequest',
49+
},
50+
],
4451
}).then(async (opportunity) => {
4552
if (!opportunity) {
4653
const err = new Error('No opportunity found');
@@ -92,12 +99,15 @@ module.exports = [
9299

93100
const emailEventType = CONNECT_NOTIFICATION_EVENT.EXTERNAL_ACTION_EMAIL;
94101
const copilotPortalUrl = config.get('copilotPortalUrl');
102+
const requestData = opportunity.copilotRequest.data;
95103
listOfSubjects.forEach((subject) => {
96104
createEvent(emailEventType, {
97105
data: {
98106
user_name: subject.handle,
99107
opportunity_details_url: `${copilotPortalUrl}/opportunity/${opportunity.id}#applications`,
100108
work_manager_url: config.get('workManagerUrl'),
109+
opportunity_type: getCopilotTypeLabel(requestData.projectType),
110+
opportunity_title: requestData.opportunityTitle,
101111
},
102112
sendgrid_template_id: TEMPLATE_IDS.APPLY_COPILOT,
103113
recipients: [subject.email],

0 commit comments

Comments
 (0)