Skip to content

Commit f3585f0

Browse files
authored
Version 0.42.1 (#987)
- fix confirmation email formatting
2 parents 989ff79 + eea0000 commit f3585f0

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "conveniat27",
3-
"version": "0.42.0",
3+
"version": "0.42.1",
44
"description": "The official website of conveniat27",
55
"license": "MIT",
66
"author": "Cyrill Püntener v/o JPG (cyrill.puentener@cevi.ch)",

src/features/payload-cms/payload-cms/plugins/form/fix-links-in-mails.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export const beforeEmailChangeHook: BeforeEmail = async (
9393
return '';
9494
};
9595

96+
let wildcardHtmlText = '';
97+
let wildcardHtmlTable =
98+
'<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse; width: 100%;">';
99+
96100
for (const item of submissionDataArray) {
97101
if (
98102
item !== null &&
@@ -101,9 +105,16 @@ export const beforeEmailChangeHook: BeforeEmail = async (
101105
typeof item.field === 'string' &&
102106
'value' in item
103107
) {
104-
submissionDict[item.field] = extractStringValue(item.value);
108+
const stringValue = extractStringValue(item.value);
109+
submissionDict[item.field] = stringValue;
110+
111+
const fieldName = escapeHTML(item.field);
112+
const fieldValue = escapeHTML(stringValue).replaceAll('\n', '<br />');
113+
wildcardHtmlText += `<strong>${fieldName}</strong>: ${fieldValue}<br />\n`;
114+
wildcardHtmlTable += `<tr><td><strong>${fieldName}</strong></td><td>${fieldValue}</td></tr>\n`;
105115
}
106116
}
117+
wildcardHtmlTable += '</table>';
107118

108119
interface MinimalLexicalNode {
109120
type: string;
@@ -181,6 +192,10 @@ export const beforeEmailChangeHook: BeforeEmail = async (
181192
}
182193
}
183194

195+
// Replace payloads wildcard variables
196+
updatedHtml = updatedHtml.replaceAll('{{*}}', () => wildcardHtmlText);
197+
updatedHtml = updatedHtml.replaceAll('{{*:table}}', () => wildcardHtmlTable);
198+
184199
return {
185200
...email,
186201
html: updatedHtml,

src/features/payload-cms/payload-cms/plugins/form/hooks/link-job-submission.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const selectedJobNotFoundMessage: StaticTranslationString = {
2121
};
2222

2323
const noJobSelectedMessage: StaticTranslationString = {
24-
en: 'no job selected',
25-
de: 'kein Job ausgewählt',
26-
fr: 'aucun job sélectionné',
24+
en: '-',
25+
de: '-',
26+
fr: '-',
2727
};
2828

2929
/**

0 commit comments

Comments
 (0)