Skip to content

feat: send custom email to signers of direct template documents - #1215

Merged
Mythie merged 5 commits into
mainfrom
feat/direct-link-custom-email
Jul 5, 2024
Merged

Mythie merged 5 commits into
mainfrom
feat/direct-link-custom-email

Conversation

@ephraimduncan

@ephraimduncan ephraimduncan commented Jul 2, 2024 •

Copy link
Copy Markdown
Contributor

Description

Introduces customization options for the document completion email template to allow for custom email bodies and subjects for documents created from direct templates.

Testing Performed

  • Verified correct rendering of custom email subject and body for direct template documents

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Summary by CodeRabbit

  • New Features

    • Added custom email template rendering for completed documents with support for dynamic message content.
    • Introduced an optional customBody prop in email templates, allowing for custom messages in email notifications.
    • Enhanced document creation from direct templates by including the recipient's name.
  • Bug Fixes

    • Removed unnecessary console logs to streamline backend operations.
  • Refactor

    • Updated multiple functions and components to accept new parameters and props for enhanced customization and functionality.

@vercel

vercel Bot commented Jul 2, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stg-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2024 2:55am
stg-docs ❌ Failed (Inspect) Jul 5, 2024 2:55am
stg-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2024 2:55am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
prd-app ⬜️ Ignored (Inspect) Jul 5, 2024 2:55am
prd-marketing ⬜️ Ignored (Inspect) Jul 5, 2024 2:55am

@coderabbitai

coderabbitai Bot commented Jul 2, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

Recent updates address several functional and structural changes across different modules. These involve introducing new variables, adding parameters for improved functionality, eliminating unnecessary logging, and allowing optional customization of email templates. Specifically, the changes enhance template customization, refine recipient handling, and bolster email generation, aiming to improve overall application robustness and user experience.

Changes

File Path Change Summary
apps/web/src/.../d/[token]/direct-template.tsx Added fullName variable and directRecipientName parameter to functions.
packages/email/template-components/template-document-completed.tsx Introduced an optional customBody prop for dynamic message display.
packages/email/templates/document-completed.tsx Added customBody property to DocumentCompletedEmailTemplateProps and updated function signature.
packages/lib/server-only/document/move-document-to-team.ts Removed console.log statement, eliminating a logging operation.
packages/lib/server-only/document/send-completed-email.ts Added DocumentSource import, included documentMeta, and implemented custom email template rendering based on isDirectTemplate.
packages/lib/server-only/template/create-document-from-direct-template.ts Added directRecipientName field and updated documentMeta creation.
packages/trpc/server/template-router/router.ts Enhanced createDocumentFromDirectTemplate by including directRecipientName in document creation.
packages/trpc/server/template-router/schema.ts Added directRecipientName as optional to the schema for ZCreateDocumentFromDirectTemplateMutationSchema.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend

    User->>+Frontend: Initiates document creation
    Frontend->>+Backend: Sends document creation request with fullName, directRecipientName
    Backend->>Backend: Process document creation, updates documentMeta, logs creation
    Backend-->>-Frontend: Returns document creation status
    Frontend-->>-User: Displays confirmation
Loading
sequenceDiagram
    participant User
    participant EmailService
    participant TemplateDocumentCompleted

    User->>+EmailService: Document completed
    EmailService->>+TemplateDocumentCompleted: Load email template with optional customBody
    TemplateDocumentCompleted-->>-EmailService: Render customized email
    EmailService-->>-User: Sends customized completion email
Loading

Poem

In the land of code, new whispers rose,
Enhancements made where function flows.
A name added, a custom touch,
Emails now can say so much.
Logging quiet, templates bright,
Our app now shines in user delight.
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions

github-actions Bot commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

🚨 @ephraimduncan has 7 pull requests awaiting review. Please consider reviewing them when possible. 🚨

@github-actions

github-actions Bot commented Jul 3, 2024

Copy link
Copy Markdown
Contributor

🚨 @ephraimduncan has 7 pull requests awaiting review. Please consider reviewing them when possible. 🚨

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range and nitpick comments (1)
packages/email/templates/document-completed.tsx (1)

16-16: Optional prop should be last in the destructuring.

For better readability, the optional customBody prop should be listed last in the destructuring.

-  downloadLink = 'https://documenso.com',
  documentName = 'Open Source Pledge.pdf',
  assetBaseUrl = 'http://localhost:3002',
  customBody,
+  customBody,
  downloadLink = 'https://documenso.com',
  documentName = 'Open Source Pledge.pdf',
  assetBaseUrl = 'http://localhost:3002',
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7cff035 and d1cdc49.

Files selected for processing (8)
  • apps/web/src/app/(recipient)/d/[token]/direct-template.tsx (2 hunks)
  • packages/email/template-components/template-document-completed.tsx (2 hunks)
  • packages/email/templates/document-completed.tsx (2 hunks)
  • packages/lib/server-only/document/move-document-to-team.ts (1 hunks)
  • packages/lib/server-only/document/send-completed-email.ts (5 hunks)
  • packages/lib/server-only/template/create-document-from-direct-template.ts (5 hunks)
  • packages/trpc/server/template-router/router.ts (1 hunks)
  • packages/trpc/server/template-router/schema.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/lib/server-only/document/move-document-to-team.ts
Additional comments not posted (13)
packages/email/templates/document-completed.tsx (1)

8-10: LGTM! But verify the usage of the new prop.

The code changes are approved.

However, ensure that all usages of DocumentCompletedEmailTemplate are updated to handle the new customBody prop.

Verification successful

The customBody prop is being utilized correctly.

The customBody prop was found being used in the DocumentCompletedEmailTemplate component in the file packages/lib/server-only/document/send-completed-email.ts.

  • packages/lib/server-only/document/send-completed-email.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all usages of `DocumentCompletedEmailTemplate` are updated to handle the new `customBody` prop.

# Test: Search for the component usage. Expect: All usages handle the new `customBody` prop.
rg --type tsx $'DocumentCompletedEmailTemplate'

Length of output: 74



Script:

#!/bin/bash
# Description: Verify all usages of `DocumentCompletedEmailTemplate` are updated to handle the new `customBody` prop.

# Test: Search for the component usage. Expect: All usages handle the new `customBody` prop.
rg 'DocumentCompletedEmailTemplate'

Length of output: 1103



Script:

#!/bin/bash
# Description: Verify if the `customBody` prop is used in the identified files where `DocumentCompletedEmailTemplate` is used.

# Search for `customBody` usage in the identified files
rg 'customBody' packages/email/templates/document-created-from-direct-template.tsx packages/lib/server-only/document/send-completed-email.ts

Length of output: 218

packages/email/template-components/template-document-completed.tsx (1)

8-8: LGTM! But verify the usage of the new prop.

The code changes are approved.

However, ensure that all usages of TemplateDocumentCompleted are updated to handle the new customBody prop.

Verification successful

The new customBody prop is correctly handled in the codebase.

  • The customBody prop is properly passed to the TemplateDocumentCompleted component in packages/email/templates/document-completed.tsx.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all usages of `TemplateDocumentCompleted` are updated to handle the new `customBody` prop.

# Test: Search for the component usage. Expect: All usages handle the new `customBody` prop.
rg --type tsx $'TemplateDocumentCompleted'

Length of output: 69



Script:

#!/bin/bash
# Description: Verify all usages of `TemplateDocumentCompleted` are updated to handle the new `customBody` prop.

# Test: Search for the component usage. Expect: All usages handle the new `customBody` prop.
rg 'TemplateDocumentCompleted'

Length of output: 1005



Script:

#!/bin/bash
# Extract and review lines around the usage of `TemplateDocumentCompleted` in packages/email/templates/document-completed.tsx

# Display lines around the usage of TemplateDocumentCompleted
rg 'TemplateDocumentCompleted' -A 5 -B 5 packages/email/templates/document-completed.tsx

Length of output: 1119

packages/trpc/server/template-router/schema.ts (1)

20-20: LGTM!

The code changes are approved.

apps/web/src/app/(recipient)/d/[token]/direct-template.tsx (1)

45-45: LGTM! But verify the usage of the new parameter.

The code changes are approved.

However, ensure that all usages of createDocumentFromDirectTemplate are updated to handle the new directRecipientName parameter.

packages/lib/server-only/document/send-completed-email.ts (2)

7-7: LGTM!

The code changes are approved.


14-14: Verify the usage of the new function.

Ensure that all usages of renderCustomEmailTemplate are correct.

Verification successful

All usages of renderCustomEmailTemplate are correct.

Each usage of the renderCustomEmailTemplate function passes a string as the first argument and an object as the second argument, which aligns with the function's definition.

  • send-completed-email.ts
    • Lines: 14, 25
  • resend-document.tsx
    • Lines: 14, 25
  • send-signing-email.ts
    • Lines: 14, 25
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all usages of `renderCustomEmailTemplate` are correct.

# Test: Search for the function usage. Expect: All usages are correct.
rg --type ts $'renderCustomEmailTemplate'

Length of output: 1328



Script:

#!/bin/bash
# Retrieve the definition of `renderCustomEmailTemplate`
ast-grep --lang typescript --pattern $'export const renderCustomEmailTemplate = <T extends Record<string, string>>($_) => $_' packages/lib/utils/render-custom-email-template.ts

Length of output: 177



Script:

#!/bin/bash
# Retrieve the definition of `renderCustomEmailTemplate` with a simpler pattern
ast-grep --lang typescript --pattern $'export const renderCustomEmailTemplate = $_' packages/lib/utils/render-custom-email-template.ts

Length of output: 1045



Script:

#!/bin/bash
# Verify the arguments passed to `renderCustomEmailTemplate` in each usage

# Check usage in `send-completed-email.ts`
rg --multiline --multiline-dotall --context 5 'renderCustomEmailTemplate' packages/lib/server-only/document/send-completed-email.ts

# Check usage in `resend-document.tsx`
rg --multiline --multiline-dotall --context 5 'renderCustomEmailTemplate' packages/lib/server-only/document/resend-document.tsx

# Check usage in `send-signing-email.ts`
rg --multiline --multiline-dotall --context 5 'renderCustomEmailTemplate' packages/lib/jobs/definitions/send-signing-email.ts

Length of output: 4533

packages/trpc/server/template-router/router.ts (2)

62-68: Ensure directRecipientName is validated.

The directRecipientName is added as an optional field to the input schema. Ensure that the validation logic is correctly handling optional fields and that the value is properly sanitized.


73-73: Ensure backward compatibility.

Adding directRecipientName as an optional field should not break existing functionality. Verify that the function handles cases where directRecipientName is not provided.

Verification successful

Ensure backward compatibility.

Adding directRecipientName as an optional field does not break existing functionality. The createDocumentFromDirectTemplate function handles cases where directRecipientName is not provided by using fallbacks and checks.

  • The directRecipientName parameter is optional in the CreateDocumentFromDirectTemplateOptions type.
  • The function assigns directRecipientName with a fallback to user?.name.
  • Additional checks ensure that if directRecipientName is undefined, it is assigned a value from signedFieldValue.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `createDocumentFromDirectTemplate` handles cases where `directRecipientName` is not provided.

# Test: Search for function usage and check for backward compatibility. Expect: No breaking changes.
rg --type js --pattern 'createDocumentFromDirectTemplate'

Length of output: 469



Script:

#!/bin/bash
# Description: Verify that `createDocumentFromDirectTemplate` handles cases where `directRecipientName` is not provided.

# Test: Search for function usage and check for backward compatibility. Expect: No breaking changes.
rg 'createDocumentFromDirectTemplate'

Length of output: 1016



Script:

#!/bin/bash
# Description: Check the implementation of `createDocumentFromDirectTemplate` and its usages to ensure backward compatibility.

# Inspect the implementation of `createDocumentFromDirectTemplate`
rg -A 10 'export const createDocumentFromDirectTemplate' packages/lib/server-only/template/create-document-from-direct-template.ts

# Inspect the usage in `router.ts`
rg -A 10 'createDocumentFromDirectTemplate' packages/trpc/server/template-router/router.ts

# Inspect the usage in `direct-template.tsx`
rg -A 10 'createDocumentFromDirectTemplate' apps/web/src/app/\(recipient\)/d/\[token\]/direct-template.tsx

Length of output: 3360



Script:

#!/bin/bash
# Description: Check the type definition of `CreateDocumentFromDirectTemplateOptions` and the logic handling `directRecipientName`.

# Inspect the type definition of `CreateDocumentFromDirectTemplateOptions`
rg -A 10 'CreateDocumentFromDirectTemplateOptions' packages/lib/server-only/template/create-document-from-direct-template.ts

# Inspect the function logic handling `directRecipientName`
rg -A 20 'directRecipientName' packages/lib/server-only/template/create-document-from-direct-template.ts

Length of output: 4257

packages/lib/server-only/template/create-document-from-direct-template.ts (5)

137-138: Ensure email message and subject are correctly set.

The metaEmailMessage and metaEmailSubject are set from template.templateMeta. Ensure that these values are correctly set and used in the email template.

Verification successful

Verified that metaEmailMessage and metaEmailSubject are correctly set and used.

The metaEmailMessage and metaEmailSubject are assigned from template.templateMeta with appropriate default values and are used correctly in the email template.

  • packages/lib/server-only/template/create-document-from-direct-template.ts:
    • Lines 137-138: Assignments
    • Lines 141-142: Usage
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `metaEmailMessage` and `metaEmailSubject` are correctly set and used.

# Test: Search for assignment and usage of `metaEmailMessage` and `metaEmailSubject`. Expect: Correct assignment and usage.
rg --type js --pattern 'metaEmailMessage|metaEmailSubject'

Length of output: 472



Script:

#!/bin/bash
# Description: Verify that `metaEmailMessage` and `metaEmailSubject` are correctly set and used.

# Test: Search for assignment and usage of `metaEmailMessage` and `metaEmailSubject`. Expect: Correct assignment and usage.
rg 'metaEmailMessage|metaEmailSubject'

Length of output: 544


42-42: Ensure directRecipientName is optional.

The directRecipientName field is added as an optional field in the CreateDocumentFromDirectTemplateOptions type. Ensure that this field is properly handled as optional throughout the code.

Verification successful

Ensure directRecipientName is optional.

The directRecipientName field is added as an optional field in the CreateDocumentFromDirectTemplateOptions type. The following usages in the create-document-from-direct-template.ts file indicate that the field is properly handled as optional:

  • The field is defined as optional: directRecipientName?: string;
  • Default value assignment: const directRecipientName = user?.name || initialDirectRecipientName;
  • Conditional checks: if (templateField.type === FieldType.NAME && directRecipientName === undefined) {

These usages ensure that the directRecipientName field is correctly managed as an optional field throughout the code.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `directRecipientName` is properly handled as an optional field.

# Test: Search for usage of `CreateDocumentFromDirectTemplateOptions`. Expect: Proper handling of optional field.
rg --type js --pattern 'CreateDocumentFromDirectTemplateOptions'

Length of output: 476



Script:

#!/bin/bash
# Description: Verify that `directRecipientName` is properly handled as an optional field.

# Test: Search for usage of `CreateDocumentFromDirectTemplateOptions`. Expect: Proper handling of optional field.
rg 'CreateDocumentFromDirectTemplateOptions'

Length of output: 297



Script:

#!/bin/bash
# Description: Verify that `directRecipientName` is properly handled as an optional field.

# Test: Search for usage of `directRecipientName` within the `create-document-from-direct-template.ts` file.
rg 'directRecipientName' packages/lib/server-only/template/create-document-from-direct-template.ts

Length of output: 432


257-263: Ensure document metadata is correctly created.

The document metadata is created with timezone, dateFormat, message, and subject. Ensure that these values are correctly set and used in the document creation process.

Verification successful

Document metadata is correctly created and used.

The metadata fields (timezone, dateFormat, message, and subject) are properly assigned and utilized across the codebase.

  • packages/ui/primitives/document-flow/add-settings.tsx
  • packages/ui/primitives/document-flow/add-subject.tsx
  • packages/lib/server-only/template/create-document-from-direct-template.ts
  • packages/lib/server-only/template/create-document-from-template.ts
  • packages/app-tests/e2e/templates/create-document-from-template.spec.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that document metadata is correctly created and used.

# Test: Search for assignment and usage of document metadata fields. Expect: Correct assignment and usage.
rg --type js --pattern 'documentMeta'

Length of output: 449



Script:

#!/bin/bash
# Description: Verify that document metadata is correctly created and used.

# Test: Search for assignment and usage of document metadata fields. Expect: Correct assignment and usage.
rg 'documentMeta'

Length of output: 10193


115-115: Ensure directRecipientName is correctly set.

The directRecipientName is set to user?.name or initialDirectRecipientName. Ensure that this logic correctly handles cases where both values are undefined.

Verification successful

Verification Successful: directRecipientName is correctly set.

The logic for setting directRecipientName using user?.name || initialDirectRecipientName correctly handles cases where both values are undefined. The subsequent usage of directRecipientName is consistent with this assignment.

  • Location: packages/lib/server-only/template/create-document-from-direct-template.ts
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `directRecipientName` is correctly set and used.

# Test: Search for assignment and usage of `directRecipientName`. Expect: Correct assignment and usage.
rg --type js --pattern 'directRecipientName'

Length of output: 456



Script:

#!/bin/bash
# Description: Verify that `directRecipientName` is correctly set and used.

# Test: Search for assignment and usage of `directRecipientName`. Expect: Correct assignment and usage.
rg 'directRecipientName'

Length of output: 1149



Script:

#!/bin/bash
# Description: Extract lines around the occurrences of `directRecipientName` in `create-document-from-direct-template.ts` for detailed inspection.

# Extract lines around the occurrences of `directRecipientName` in the specified file.
rg -A 3 -B 3 'directRecipientName' packages/lib/server-only/template/create-document-from-direct-template.ts

Length of output: 1443


61-61: Ensure initialDirectRecipientName is correctly assigned.

The initialDirectRecipientName is derived from directRecipientName or set to 'Default Name'. Ensure that this assignment logic is correct and does not introduce any bugs.

….tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d1cdc49 and a71a059.

Files selected for processing (1)
  • packages/email/template-components/template-document-completed.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/email/template-components/template-document-completed.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
packages/lib/server-only/document/send-completed-email.ts (2)

44-44: Consider extracting the condition to a variable.

For better readability, consider extracting the isDirectTemplate condition to a variable.

-  const isDirectTemplate = document?.source === DocumentSource.TEMPLATE_DIRECT_LINK;
+  const isDirectTemplate = document.source === DocumentSource.TEMPLATE_DIRECT_LINK;

114-119: Consider moving the custom email template data to a separate function.

For better readability and maintainability, consider moving the custom email template data creation to a separate function.

-  const customEmailTemplate = {
-    'signer.name': recipient.name,
-    'signer.email': recipient.email,
-    'document.name': document.title,
-  };
+  const customEmailTemplate = createCustomEmailTemplateData(recipient, document);
function createCustomEmailTemplateData(recipient, document) {
  return {
    'signer.name': recipient.name,
    'signer.email': recipient.email,
    'document.name': document.title,
  };
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a71a059 and 1074b08.

Files selected for processing (1)
  • packages/lib/server-only/document/send-completed-email.ts (5 hunks)
Additional comments not posted (5)
packages/lib/server-only/document/send-completed-email.ts (5)

7-7: Import DocumentSource is used correctly.

The DocumentSource import is used to check if the document is a direct template.


14-14: Import renderCustomEmailTemplate is used correctly.

The renderCustomEmailTemplate import is used to render custom email templates.


28-28: Ensure documentMeta is populated correctly.

The inclusion of documentMeta in the prisma.document.findUnique query is necessary for accessing custom email metadata.


126-129: Ensure custom email body rendering is correct.

The custom email body is rendered correctly based on the isDirectTemplate condition.


143-146: Ensure custom email subject rendering is correct.

The custom email subject is rendered correctly based on the isDirectTemplate condition.

This branch had an error being deployed

1 failed and 2 active deployments
Preview – stg-docs — 1074b085 Deployed Jul 5, 2024 by vercel[bot]
Preview – stg-app — 1074b085 Deployed Jul 5, 2024 by vercel[bot]
Preview – stg-marketing — 1074b085 Deployed Jul 5, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps: web Issues related to the webapp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants