Skip to content

Commit 668d278

Browse files
committed
fix sending interview confirmation email
1 parent a336c1d commit 668d278

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

scripts/demo-email-notifications/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async function initConsumer () {
9898
if (message.payload.notifications) {
9999
_.forEach(_.filter(message.payload.notifications, ['serviceId', 'email']), (notification) => {
100100
const email = templateFileMap[notification.details.sendgridTemplateId](notification.details.data)
101-
fs.writeFileSync(`./out/${notification.details.data.subject}-${Date.now()}.html`, email)
101+
fs.writeFileSync(`./out/${notification.details.data.subject.replace(/[^a-z0-9 ]/gi, '_')}-${Date.now()}.html`, email)
102102
})
103103
for (const notification of _.filter(message.payload.notifications, ['serviceId', 'slack'])) {
104104
if (process.env.SLACK_WEBHOOK_URL) {

src/services/InterviewService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ requestInterview.schema = Joi.object().keys({
386386
* @returns {Object} updated interview
387387
*/
388388
async function partiallyUpdateInterview (currentUser, interview, data) {
389+
const oldInterviewValue = interview.toJSON()
389390
// only status can be updated for Completed interviews
390391
if (interview.status === InterviewConstants.Status.Completed) {
391392
const updatedFields = _.keys(data)
@@ -434,7 +435,7 @@ async function partiallyUpdateInterview (currentUser, interview, data) {
434435
// if reaches here, it's not one of the common errors handled in `handleSequelizeError`
435436
throw err
436437
}
437-
await helper.postEvent(config.TAAS_INTERVIEW_UPDATE_TOPIC, entity, { oldValue: interview.toJSON() })
438+
await helper.postEvent(config.TAAS_INTERVIEW_UPDATE_TOPIC, entity, { oldValue: oldInterviewValue })
438439
return entity
439440
}
440441

0 commit comments

Comments
 (0)