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 = [
|
const ALPHA_FEATURES = [
|
||||||
|
'emailCardSegments',
|
||||||
'multipleProducts',
|
'multipleProducts',
|
||||||
'psmRedesign'
|
'psmRedesign'
|
||||||
];
|
];
|
||||||
|
|
|
@ -18,6 +18,7 @@ const db = require('../../data/db');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
const postEmailSerializer = require('./post-email-serializer');
|
const postEmailSerializer = require('./post-email-serializer');
|
||||||
const {getSegmentsFromHtml} = require('./segment-parser');
|
const {getSegmentsFromHtml} = require('./segment-parser');
|
||||||
|
const labs = require('../labs');
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
invalidSegment: 'Invalid segment value. Use one of the valid:"status:free" or "status:-free" values.'
|
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 [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const segments = getSegmentsFromHtml(emailModel.get('html'));
|
if (labs.isSet('emailCardSegments')) {
|
||||||
const batchIds = [];
|
const segments = getSegmentsFromHtml(emailModel.get('html'));
|
||||||
|
const batchIds = [];
|
||||||
|
|
||||||
if (segments.length) {
|
if (segments.length) {
|
||||||
const partitionedMembers = partitionMembersBySegment(memberRows, segments);
|
const partitionedMembers = partitionMembersBySegment(memberRows, segments);
|
||||||
|
|
||||||
for (const partition in partitionedMembers) {
|
for (const partition in partitionedMembers) {
|
||||||
const emailBatchIds = await createEmailBatches({
|
const emailBatchIds = await createEmailBatches({
|
||||||
emailModel,
|
emailModel,
|
||||||
memberRows: partitionedMembers[partition],
|
memberRows: partitionedMembers[partition],
|
||||||
memberSegment: partition === 'unsegmented' ? null : partition,
|
memberSegment: partition === 'unsegmented' ? null : partition,
|
||||||
options
|
options
|
||||||
});
|
});
|
||||||
batchIds.push(emailBatchIds);
|
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;
|
return batchIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue