fix: custom team email subject (#1450)

Fixed issue where custom email subjects for teams were being ignored.
This commit is contained in:
David Nguyen
2024-11-06 22:16:31 +09:00
committed by GitHub
parent ffc61af904
commit 61ea4971ad
2 changed files with 21 additions and 11 deletions

View File

@ -115,9 +115,11 @@ export const SEND_SIGNING_EMAIL_JOB_DEFINITION = {
if (isTeamDocument && team) { if (isTeamDocument && team) {
emailSubject = i18n._(msg`${team.name} invited you to ${recipientActionVerb} a document`); emailSubject = i18n._(msg`${team.name} invited you to ${recipientActionVerb} a document`);
emailMessage = i18n._( emailMessage =
msg`${user.name} on behalf of ${team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`, customEmail?.message ||
); i18n._(
msg`${user.name} on behalf of ${team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`,
);
} }
const customEmailTemplate = { const customEmailTemplate = {

View File

@ -106,17 +106,25 @@ export const resendDocument = async ({
._(RECIPIENT_ROLES_DESCRIPTION[recipient.role].actionVerb) ._(RECIPIENT_ROLES_DESCRIPTION[recipient.role].actionVerb)
.toLowerCase(); .toLowerCase();
let emailMessage = msg`${customEmail?.message || ''}`; let emailMessage = customEmail?.message || '';
let emailSubject = msg`Reminder: Please ${recipientActionVerb} this document`; let emailSubject = i18n._(msg`Reminder: Please ${recipientActionVerb} this document`);
if (selfSigner) { if (selfSigner) {
emailMessage = msg`You have initiated the document ${`"${document.title}"`} that requires you to ${recipientActionVerb} it.`; emailMessage = i18n._(
emailSubject = msg`Reminder: Please ${recipientActionVerb} your document`; msg`You have initiated the document ${`"${document.title}"`} that requires you to ${recipientActionVerb} it.`,
);
emailSubject = i18n._(msg`Reminder: Please ${recipientActionVerb} your document`);
} }
if (isTeamDocument && document.team) { if (isTeamDocument && document.team) {
emailSubject = msg`Reminder: ${document.team.name} invited you to ${recipientActionVerb} a document`; emailSubject = i18n._(
emailMessage = msg`${user.name} on behalf of ${document.team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`; msg`Reminder: ${document.team.name} invited you to ${recipientActionVerb} a document`,
);
emailMessage =
customEmail?.message ||
i18n._(
msg`${user.name} on behalf of ${document.team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`,
);
} }
const customEmailTemplate = { const customEmailTemplate = {
@ -134,7 +142,7 @@ export const resendDocument = async ({
inviterEmail: isTeamDocument ? document.team?.teamEmail?.email || user.email : user.email, inviterEmail: isTeamDocument ? document.team?.teamEmail?.email || user.email : user.email,
assetBaseUrl, assetBaseUrl,
signDocumentLink, signDocumentLink,
customBody: renderCustomEmailTemplate(i18n._(emailMessage), customEmailTemplate), customBody: renderCustomEmailTemplate(emailMessage, customEmailTemplate),
role: recipient.role, role: recipient.role,
selfSigner, selfSigner,
isTeamInvite: isTeamDocument, isTeamInvite: isTeamDocument,
@ -165,7 +173,7 @@ export const resendDocument = async ({
i18n._(msg`Reminder: ${customEmail.subject}`), i18n._(msg`Reminder: ${customEmail.subject}`),
customEmailTemplate, customEmailTemplate,
) )
: i18n._(emailSubject), : emailSubject,
html, html,
text, text,
}); });