mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Moved the gated email card feature behing an alpha flag
issue https://github.com/TryGhost/Team/issues/842
This commit is contained in:
parent
607623211a
commit
3ca4cd99f1
2 changed files with 19 additions and 15 deletions
|
@ -15,6 +15,7 @@ const BETA_FEATURES = [
|
|||
];
|
||||
|
||||
const ALPHA_FEATURES = [
|
||||
'emailCardSegments',
|
||||
'multipleProducts',
|
||||
'psmRedesign'
|
||||
];
|
||||
|
|
|
@ -18,6 +18,7 @@ const db = require('../../data/db');
|
|||
const models = require('../../models');
|
||||
const postEmailSerializer = require('./post-email-serializer');
|
||||
const {getSegmentsFromHtml} = require('./segment-parser');
|
||||
const labs = require('../labs');
|
||||
|
||||
const messages = {
|
||||
invalidSegment: 'Invalid segment value. Use one of the valid:"status:free" or "status:-free" values.'
|
||||
|
@ -414,26 +415,28 @@ async function createSegmentedEmailBatches({emailModel, options}) {
|
|||
return [];
|
||||
}
|
||||
|
||||
const segments = getSegmentsFromHtml(emailModel.get('html'));
|
||||
const batchIds = [];
|
||||
if (labs.isSet('emailCardSegments')) {
|
||||
const segments = getSegmentsFromHtml(emailModel.get('html'));
|
||||
const batchIds = [];
|
||||
|
||||
if (segments.length) {
|
||||
const partitionedMembers = partitionMembersBySegment(memberRows, segments);
|
||||
if (segments.length) {
|
||||
const partitionedMembers = partitionMembersBySegment(memberRows, segments);
|
||||
|
||||
for (const partition in partitionedMembers) {
|
||||
const emailBatchIds = await createEmailBatches({
|
||||
emailModel,
|
||||
memberRows: partitionedMembers[partition],
|
||||
memberSegment: partition === 'unsegmented' ? null : partition,
|
||||
options
|
||||
});
|
||||
batchIds.push(emailBatchIds);
|
||||
for (const partition in partitionedMembers) {
|
||||
const emailBatchIds = await createEmailBatches({
|
||||
emailModel,
|
||||
memberRows: partitionedMembers[partition],
|
||||
memberSegment: partition === 'unsegmented' ? null : partition,
|
||||
options
|
||||
});
|
||||
batchIds.push(emailBatchIds);
|
||||
}
|
||||
return batchIds;
|
||||
}
|
||||
} else {
|
||||
const emailBatchIds = await createEmailBatches({emailModel, memberRows, options});
|
||||
batchIds.push(emailBatchIds);
|
||||
}
|
||||
|
||||
const emailBatchIds = await createEmailBatches({emailModel, memberRows, options});
|
||||
const batchIds = [emailBatchIds];
|
||||
return batchIds;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue