mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
a801352c7f
no issue - adjusted mega's post serializer to get full email contents - fetch `mobiledoc` from the API rather than the pre-rendered `html` and `plaintext` - re-generate `html` using the mobiledoc renderer with an "email" target so that the email-only card content is included - re-generate `plaintext` from the newly generated email html - added replacement handling to mega's `getEmailData` function - find all of our `%%{replacement "fallback"}%%` instances in the html template and push them into a replacements array with the respective property on the member instance and desired fallback - transform the replacement for Mailgun compatibility. Mailgun uses `%recipient.variable_name%` for its template variables so we need to replace our custom replacement string with the compatible version. Our replacements system allows for the same replacement (`{subscriber_name}`) to be used multiple times and have different fallbacks, Mailgun doesn't support fallbacks so for each replacement we also need an indexed `variable_name` part so that we can put our fallbacks in the correct place - perform the same Mailgun template transformation for the plaintext version except we re-use the replacements array to avoid bloating the API request to Mailgun with duplicate template variables for every recipient - swapped `reduce` for a plain loop for easier readability |
||
---|---|---|
.. | ||
client@1a1cb22ba4 | ||
frontend | ||
server | ||
shared/nql-map-key-values | ||
index.js |