feat(campaign-ui): configure attachment delivery behavior

This commit is contained in:
2026-07-20 20:08:53 +02:00
parent 0a6064ec62
commit c71fa3dc64
3 changed files with 45 additions and 22 deletions

View File

@@ -22,15 +22,21 @@ export function ensureCampaignDraft(version: CampaignVersionDetail | null): Reco
raw.server = isRecord(raw.server) ? raw.server : {};
raw.recipients = isRecord(raw.recipients) ? raw.recipients : {};
raw.template = isRecord(raw.template) ? raw.template : { subject: "", text: "" };
const sourceAttachments = asRecord(raw.attachments);
raw.attachments = {
base_path: ".",
allow_individual: false,
send_without_attachments: true,
send_without_attachments_behavior: "continue",
global: [],
missing_behavior: "ask",
ambiguous_behavior: "ask",
...asRecord(raw.attachments)
...sourceAttachments
};
const normalizedAttachments = asRecord(raw.attachments);
if (sourceAttachments.send_without_attachments_behavior === undefined) {
normalizedAttachments.send_without_attachments_behavior = getBool(normalizedAttachments, "send_without_attachments", true) ? "continue" : "block";
}
raw.entries = isRecord(raw.entries) ? raw.entries : { inline: [] };
raw.validation_policy = {
unsent_attachment_files: "warn",