diff --git a/apps/web/src/app/(signing)/sign/[token]/signing-page-view.tsx b/apps/web/src/app/(signing)/sign/[token]/signing-page-view.tsx index 19057abf8..5e4d47ec4 100644 --- a/apps/web/src/app/(signing)/sign/[token]/signing-page-view.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/signing-page-view.tsx @@ -53,6 +53,17 @@ export const SigningPageView = ({ }: SigningPageViewProps) => { const { documentData, documentMeta } = document; + const shouldUseTeamDetails = + document.teamId && document.team?.teamGlobalSettings?.includeSenderDetails === false; + + let senderName = document.User.name ?? ''; + let senderEmail = `(${document.User.email})`; + + if (shouldUseTeamDetails) { + senderName = document.team?.name ?? ''; + senderEmail = document.team?.teamEmail?.email ? `(${document.team.teamEmail.email})` : ''; + } + return (

-
-

- {document.User.name} -

- -

+

+ + {senderName} {senderEmail} + {' '} + {match(recipient.role) - .with(RecipientRole.VIEWER, () => ( - ({document.User.email}) has invited you to view this document - )) - .with(RecipientRole.SIGNER, () => ( - ({document.User.email}) has invited you to sign this document - )) - .with(RecipientRole.APPROVER, () => ( - ({document.User.email}) has invited you to approve this document - )) + .with(RecipientRole.VIEWER, () => + document.teamId && !shouldUseTeamDetails ? ( + + on behalf of "{document.team?.name}" has invited you to view this document + + ) : ( + has invited you to view this document + ), + ) + .with(RecipientRole.SIGNER, () => + document.teamId && !shouldUseTeamDetails ? ( + + on behalf of "{document.team?.name}" has invited you to sign this document + + ) : ( + has invited you to sign this document + ), + ) + .with(RecipientRole.APPROVER, () => + document.teamId && !shouldUseTeamDetails ? ( + + on behalf of "{document.team?.name}" has invited you to approve this document + + ) : ( + has invited you to approve this document + ), + ) .otherwise(() => null)} -

+
diff --git a/packages/email/template-components/template-document-invite.tsx b/packages/email/template-components/template-document-invite.tsx index f49e0d106..8c550fbfa 100644 --- a/packages/email/template-components/template-document-invite.tsx +++ b/packages/email/template-components/template-document-invite.tsx @@ -61,7 +61,7 @@ export const TemplateDocumentInvite = ({ <> {includeSenderDetails ? ( - {inviterName} on behalf of {teamName} has invited you to{' '} + {inviterName} on behalf of "{teamName}" has invited you to{' '} {_(actionVerb).toLowerCase()} ) : ( diff --git a/packages/email/templates/document-invite.tsx b/packages/email/templates/document-invite.tsx index 2db1cccdb..9f6c833c4 100644 --- a/packages/email/templates/document-invite.tsx +++ b/packages/email/templates/document-invite.tsx @@ -42,7 +42,7 @@ export const DocumentInviteEmailTemplate = ({ if (isTeamInvite) { previewText = includeSenderDetails - ? msg`${inviterName} on behalf of ${teamName} has invited you to ${action} ${documentName}` + ? msg`${inviterName} on behalf of "${teamName}" has invited you to ${action} ${documentName}` : msg`${teamName} has invited you to ${action} ${documentName}`; } @@ -90,14 +90,16 @@ export const DocumentInviteEmailTemplate = ({
- - - {inviterName}{' '} - - ({inviterEmail}) - - - + {!isTeamInvite && ( + + + {inviterName}{' '} + + ({inviterEmail}) + + + + )} {customBody ? ( diff --git a/packages/lib/jobs/definitions/emails/send-signing-email.ts b/packages/lib/jobs/definitions/emails/send-signing-email.ts index 32859ce14..9c1d9ba5f 100644 --- a/packages/lib/jobs/definitions/emails/send-signing-email.ts +++ b/packages/lib/jobs/definitions/emails/send-signing-email.ts @@ -133,7 +133,7 @@ export const SEND_SIGNING_EMAIL_JOB_DEFINITION = { if (!emailMessage) { emailMessage = i18n._( team.teamGlobalSettings?.includeSenderDetails - ? msg`${user.name} on behalf of ${team.name} has invited you to ${recipientActionVerb} the document "${document.title}".` + ? msg`${user.name} on behalf of "${team.name}" has invited you to ${recipientActionVerb} the document "${document.title}".` : msg`${team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`, ); } diff --git a/packages/lib/server-only/document/get-document-by-token.ts b/packages/lib/server-only/document/get-document-by-token.ts index 4a6139514..3fc79709b 100644 --- a/packages/lib/server-only/document/get-document-by-token.ts +++ b/packages/lib/server-only/document/get-document-by-token.ts @@ -81,6 +81,17 @@ export const getDocumentAndSenderByToken = async ({ token, }, }, + team: { + select: { + name: true, + teamEmail: true, + teamGlobalSettings: { + select: { + includeSenderDetails: true, + }, + }, + }, + }, }, }); diff --git a/packages/lib/server-only/document/resend-document.tsx b/packages/lib/server-only/document/resend-document.tsx index d87be344d..fa7952213 100644 --- a/packages/lib/server-only/document/resend-document.tsx +++ b/packages/lib/server-only/document/resend-document.tsx @@ -134,7 +134,7 @@ export const resendDocument = async ({ emailMessage = customEmail?.message || i18n._( - msg`${user.name} on behalf of ${document.team.name} has invited you to ${recipientActionVerb} the document "${document.title}".`, + msg`${user.name} on behalf of "${document.team.name}" has invited you to ${recipientActionVerb} the document "${document.title}".`, ); }