mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 18:04:55 +10:00
feat: add option to disable Document created from template (#2609)
This commit is contained in:
@@ -24,6 +24,7 @@ import { jobs } from '../../jobs/client';
|
||||
import { DOCUMENT_AUDIT_LOG_TYPE, RECIPIENT_DIFF_TYPE } from '../../types/document-audit-logs';
|
||||
import type { TRecipientActionAuthTypes } from '../../types/document-auth';
|
||||
import { DocumentAccessAuth, ZRecipientAuthOptionsSchema } from '../../types/document-auth';
|
||||
import { extractDerivedDocumentEmailSettings } from '../../types/document-email';
|
||||
import { ZFieldMetaSchema } from '../../types/field-meta';
|
||||
import {
|
||||
ZWebhookDocumentSchema,
|
||||
@@ -743,14 +744,17 @@ export const createDocumentFromDirectTemplate = async ({
|
||||
};
|
||||
});
|
||||
|
||||
// Send email to template owner via background job.
|
||||
await jobs.triggerJob({
|
||||
name: 'send.document.created.from.direct.template.email',
|
||||
payload: {
|
||||
envelopeId: createdEnvelope.id,
|
||||
recipientId,
|
||||
},
|
||||
});
|
||||
const emailSettings = extractDerivedDocumentEmailSettings(documentMeta);
|
||||
|
||||
if (emailSettings.ownerDocumentCreated) {
|
||||
await jobs.triggerJob({
|
||||
name: 'send.document.created.from.direct.template.email',
|
||||
payload: {
|
||||
envelopeId: createdEnvelope.id,
|
||||
recipientId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// This handles sending emails and sealing the document if required.
|
||||
|
||||
@@ -440,6 +440,7 @@ export const generateSampleWebhookPayload = (
|
||||
documentCompleted: true,
|
||||
ownerDocumentCompleted: true,
|
||||
ownerRecipientExpired: true,
|
||||
ownerDocumentCreated: true,
|
||||
recipientSigningRequest: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user