Stored new source data for emails

refs https://github.com/TryGhost/Team/issues/2280
refs 9b0c21e0a2

As part of the email stability work, we added new `source` and `source_type` columns to `email` table, which allows us to store the email source information. The source for all existing emails before the stability work was always `html`, while newer emails will store `mobiledoc` or `lexical` directly.

While the `source` for all existing emails was populated with the `html` as part of above migration, we also need to store the right `source` for all new emails created till the feature is under a flag.

This change updates the current email flow to also store `source` with html data, so it can be used in future with new email service and allows removing old `html` column.
This commit is contained in:
Rishabh 2022-11-24 15:31:39 +05:30 committed by Rishabh Garg
parent f5e1e6296c
commit c5abef057c

View File

@ -238,6 +238,8 @@ const addEmail = async (postModel, options) => {
from: emailData.from,
reply_to: emailData.replyTo,
html: emailData.html,
source: emailData.html,
source_type: 'html',
plaintext: emailData.plaintext,
submitted_at: moment().toDate(),
track_opens: !!settingsCache.get('email_track_opens'),