Add control for completed-document email attachments#1
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a document-level email setting to control whether finalized PDFs are attached to completion emails while preserving completion notifications and links.
Changes:
- Adds
attachCompletedDocumentto document email settings defaults, schema, UI, webhook sample data, and tests. - Updates completion email sending to conditionally include finalized PDF attachments.
- Extends E2E expectations for document/team/API settings propagation.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/ui/components/document/document-email-checkboxes.tsx |
Adds the new attachment toggle to shared email settings UI. |
packages/lib/types/document-email.ts |
Adds schema/default/derived-setting support for the new setting. |
packages/lib/types/document-email.test.ts |
Adds unit coverage for default and explicit false parsing. |
packages/lib/server-only/webhooks/trigger/generate-sample-data.ts |
Includes the new setting in sample webhook metadata. |
packages/lib/server-only/document/send-completed-email.ts |
Uses the setting to decide whether completion email attachments are generated/sent. |
packages/app-tests/e2e/organisations/organisation-team-preferences.spec.ts |
Updates expected persisted organisation/team email settings. |
packages/app-tests/e2e/envelope-editor-v2/envelope-settings.spec.ts |
Adds UI persistence checks for the new toggle. |
packages/app-tests/e2e/document-flow/autosave-subject-step.spec.ts |
Adds autosave assertions for the new setting. |
packages/app-tests/e2e/api/v2/envelopes-api.spec.ts |
Updates API-created envelope email settings expectations. |
package-lock.json |
Contains unrelated dependency lock metadata changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const completedDocumentEmailAttachments = emailSettings.attachCompletedDocument | ||
| ? await Promise.all( | ||
| envelope.envelopeItems.map(async (envelopeItem) => { | ||
| const file = await getFileServerSide(envelopeItem.documentData); |
|
@copilot apply changes based on the comments in this thread |
Addressed in b16cf43. I updated the admin settings label map for the new key, normalized legacy persisted values before rendering/toggling the checkbox, avoided fetching completed PDFs when no completion emails will be sent, and added focused Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Description
Healthcare and other high-confidentiality workflows need signing emails without exposing document contents via inbox attachments. This change adds a document-level email setting to suppress completed PDF attachments while still sending completion/signing links.
Email settings model
attachCompletedDocumentto document email settings with a default oftrueCompletion email behavior
attachCompletedDocumentis enabledUI / API surface
Related Issue
Handled separately by automation.
Test Details
attachCompletedDocumentenabled and disabled across editor/API/default-setting paths, plus completion-email settings with both completion email types disabledattachCompletedDocumentistrue, legacy settings render the toggle as enabled by default, and no completed PDFs are fetched when no completion emails will be sentChecklist
Additional Notes
This remains intentionally scoped to completed-document attachments. It does not change signing-link generation or recipient access via signing/completion routes, but it now also includes follow-up fixes for legacy setting normalization and for avoiding unnecessary PDF loading on completion.