From fac47b8d519e6f306df7bf2da35cc42967085e81 Mon Sep 17 00:00:00 2001 From: Kateryna Voronina <51786805+katamatata@users.noreply.github.com> Date: Thu, 12 Dec 2024 10:18:58 +0100 Subject: [PATCH] chore(con): update emails (#1002) * Update calendar link for mentors in Germany * Fix typo in the checkbox name on TP * Update the styling in the mentorship-decline-email * Add menteeApplicationText to the mentorship-request-email * Add truncation to the mentee application text in the mentorship-request-email --- .../templates/mentorship-decline-email.malmo.mjml | 10 +++------- .../email/templates/mentorship-decline-email.mjml | 10 +++------- .../templates/mentorship-request-email.malmo.mjml | 6 ++++-- .../email/templates/mentorship-request-email.mjml | 6 ++++-- .../con-mentorship-matches.service.ts | 1 + apps/nestjs-api/src/email/lib/email/email.js | 9 +++++++++ 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.malmo.mjml b/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.malmo.mjml index 18cf6cc29..7932239d8 100644 --- a/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.malmo.mjml +++ b/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.malmo.mjml @@ -20,14 +20,10 @@ >They provided the following reason and message for you: - ${reasonForDecline} - ${optionalMessageToMentee} + ${reasonForDecline} + ${optionalMessageToMentee} - Even if this match did not work out, we still have many amazing mentors waiting for your application. So please have a look and apply to another mentor who might be an even better match for diff --git a/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.mjml b/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.mjml index 505bd771e..ac13dae4d 100644 --- a/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.mjml +++ b/apps/nestjs-api/src/assets/email/templates/mentorship-decline-email.mjml @@ -20,14 +20,10 @@ >They provided the following reason and message for you: - ${reasonForDecline} - ${optionalMessageToMentee} + ${reasonForDecline} + ${optionalMessageToMentee} - Even if this match did not work out, we still have many amazing mentors waiting for your application. So please have a look and apply to another mentor who might be an even better match for diff --git a/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.malmo.mjml b/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.malmo.mjml index 6702442e2..58b7489ff 100644 --- a/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.malmo.mjml +++ b/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.malmo.mjml @@ -16,9 +16,11 @@ You have received a mentee application from ${menteeFullName} from - ReDI ${locationNameFormatted}! + ReDI ${locationNameFormatted}! Here is a message + from them: - ${menteeApplicationText} + Please log into ReDI Connect to review this application and visit the profile of the mentee at your earliest convenience: diff --git a/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.mjml b/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.mjml index 95de7a921..bdbd8955e 100644 --- a/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.mjml +++ b/apps/nestjs-api/src/assets/email/templates/mentorship-request-email.mjml @@ -16,9 +16,11 @@ You have received a mentee application from ${menteeFullName} from - ReDI ${locationNameFormatted}! + ReDI ${locationNameFormatted}! Here is a message + from them: - ${menteeApplicationText} + Please log into ReDI Connect to review this application and visit the profile of the mentee at your earliest convenience: diff --git a/apps/nestjs-api/src/con-mentorship-matches/con-mentorship-matches.service.ts b/apps/nestjs-api/src/con-mentorship-matches/con-mentorship-matches.service.ts index dcd6288e0..e4a4964b5 100644 --- a/apps/nestjs-api/src/con-mentorship-matches/con-mentorship-matches.service.ts +++ b/apps/nestjs-api/src/con-mentorship-matches/con-mentorship-matches.service.ts @@ -249,6 +249,7 @@ export class ConMentorshipMatchesService { menteeFullName: menteeProfile.props.fullName, menteeRediLocation: menteeProfile.props.rediLocation, rediLocation: mentorProfile.props.rediLocation, + applicationText: input.applicationText, }) return result diff --git a/apps/nestjs-api/src/email/lib/email/email.js b/apps/nestjs-api/src/email/lib/email/email.js index 34e79de02..73d9f2f01 100644 --- a/apps/nestjs-api/src/email/lib/email/email.js +++ b/apps/nestjs-api/src/email/lib/email/email.js @@ -419,11 +419,19 @@ export const sendMentorshipRequestReceivedEmail = ({ menteeFullName, menteeRediLocation, rediLocation, + applicationText, }) => { + const truncateText = (text, maxLength) => { + return text.length > maxLength ? `${text.slice(0, maxLength)}...` : text + } + + const truncatedApplicationText = truncateText(applicationText, 250) + const applicationsPageUrl = `${buildFrontendUrl( process.env.NODE_ENV, rediLocation )}/app/applications` + const sendMentorshipRequestReceivedEmailParsed = convertTemplateToHtml( rediLocation, 'mentorship-request-email' @@ -436,6 +444,7 @@ export const sendMentorshipRequestReceivedEmail = ({ .replace(/\${mentorName}/g, mentorName) .replace(/\${menteeFullName}/g, menteeFullName) .replace(/\${applicationsPageUrl}/g, applicationsPageUrl) + .replace(/\${menteeApplicationText}/g, truncatedApplicationText) return sendMjmlEmailFactory({ to: recipient, subject: `You have received an application from ${menteeFullName}!`,