Added member_segment persistance to email_batches

refs https://github.com/TryGhost/Team/issues/828

- We need a way to recreate a filter that was used to create an email content for specific email_recipient. By saving member_segment value for each email_batch we can traverse back to the filter that was applied during email creation.
This commit is contained in:
Naz 2021-06-30 18:32:19 +04:00
parent 0b333765d4
commit d33baf9ba4

View File

@ -406,8 +406,10 @@ async function createEmailBatches({emailModel, memberSegment, options}) {
const storeRecipientBatch = async function (recipients) {
const knexOptions = _.pick(options, ['transacting', 'forUpdate']);
// TODO: store `memberSegment` in EmailBatch once the table migration is merged
const batchModel = await models.EmailBatch.add({email_id: emailModel.id}, knexOptions);
const batchModel = await models.EmailBatch.add({
email_id: emailModel.id,
member_segment: memberSegment
}, knexOptions);
const recipientData = [];