0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Removed filtering in mega

This is no longer necessary as we unsubscribe members from newsletters when
their email is suppressed.
This commit is contained in:
Fabien "egg" O'Carroll 2022-12-06 23:57:50 +07:00 committed by Fabien 'egg' O'Carroll
parent 939e3ce96f
commit 69e080e9a0

View file

@ -15,7 +15,6 @@ const db = require('../../data/db');
const models = require('../../models');
const postEmailSerializer = require('./post-email-serializer');
const {getSegmentsFromHtml} = require('./segment-parser');
const emailSuppressionList = require('../email-suppression-list');
const labs = require('../../../shared/labs');
// Used to listen to email.added and email.edited model events originally, I think to offload this - ideally would just use jobs now if possible
@ -564,15 +563,6 @@ async function createEmailBatches({emailModel, memberRows, memberSegment, option
debug('createEmailBatches: storing recipient list');
const startOfRecipientStorage = Date.now();
let rowsToBatch = memberRows;
if (labs.isSet('suppressionList')) {
const emails = memberRows.map(row => row.email);
const emailSuppressionData = await emailSuppressionList.getBulkSuppressionData(emails);
const emailSuppressedLookup = _.zipObject(emails, emailSuppressionData);
const filteredRows = memberRows.filter((row) => {
return emailSuppressedLookup[row.email].suppressed === false;
});
rowsToBatch = filteredRows;
}
const batches = _.chunk(rowsToBatch, bulkEmailService.BATCH_SIZE);
const batchIds = await Promise.mapSeries(batches, storeRecipientBatch);
debug(`createEmailBatches: stored recipient list (${Date.now() - startOfRecipientStorage}ms)`);