Skip to content

Commit 71f598c

Browse files
authored
Merge pull request #821 from topcoder-platform/pm-1356
fix(PM-1356): send project member invite email via external email event
2 parents 7bae3fd + 12fab3a commit 71f598c

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
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']
152+
only: ['develop', 'migration-setup', 'pm-1356']
153153
- deployProd:
154154
context : org-global
155155
filters:

src/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export const CONNECT_NOTIFICATION_EVENT = {
310310
export const TEMPLATE_IDS = {
311311
APPLY_COPILOT: 'd-d7c1f48628654798a05c8e09e52db14f',
312312
CREATE_REQUEST: 'd-3efdc91da580479d810c7acd50a4c17f',
313+
PROJECT_MEMBER_INVITED: 'd-b47a25b103604bc28fc0ce77e77fb681',
313314
}
314315
export const REGEX = {
315316
URL: /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,15})+(\:[0-9]{2,5})?(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=;]*)?$/, // eslint-disable-line

src/routes/projectMemberInvites/create.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
RESOURCES,
1515
MAX_PARALLEL_REQUEST_QTY,
1616
CONNECT_NOTIFICATION_EVENT,
17+
TEMPLATE_IDS,
1718
} from '../../constants';
1819
import { createEvent } from '../../services/busApi';
1920
import { PERMISSION, PROJECT_TO_TOPCODER_ROLES_MATRIX } from '../../permissions/constants';
@@ -201,7 +202,7 @@ const buildCreateInvitePromises = (req, inviteEmails, inviteUserIds, invites, da
201202
const sendInviteEmail = (req, projectId, invite) => {
202203
req.log.debug(`Sending invite email: ${JSON.stringify(req.body)}, ${projectId}, ${JSON.stringify(invite)}`);
203204
req.log.debug(req.authUser);
204-
const emailEventType = CONNECT_NOTIFICATION_EVENT.PROJECT_MEMBER_EMAIL_INVITE_CREATED;
205+
const emailEventType = CONNECT_NOTIFICATION_EVENT.EXTERNAL_ACTION_EMAIL;
205206
const promises = [
206207
models.Project.findOne({
207208
where: { id: projectId },
@@ -237,13 +238,9 @@ const sendInviteEmail = (req, projectId, invite) => {
237238
],
238239
}],
239240
},
241+
sendgrid_template_id: TEMPLATE_IDS.PROJECT_MEMBER_INVITED,
240242
recipients: [invite.email],
241243
version: 'v3',
242-
from: {
243-
name: config.get('EMAIL_INVITE_FROM_NAME'),
244-
email: config.get('EMAIL_INVITE_FROM_EMAIL'),
245-
},
246-
categories: [`${process.env.NODE_ENV}:${emailEventType}`.toLowerCase()],
247244
}, req.log);
248245
}).catch((error) => {
249246
req.log.error(error);

0 commit comments

Comments
 (0)