From d33baf9ba42f01115c1a0d89b4ede35b59d50293 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 30 Jun 2021 18:32:19 +0400 Subject: [PATCH] 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. --- core/server/services/mega/mega.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/server/services/mega/mega.js b/core/server/services/mega/mega.js index 94e3ec907b..85ab781786 100644 --- a/core/server/services/mega/mega.js +++ b/core/server/services/mega/mega.js @@ -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 = [];