Merge branch 'development' of https://github.com/Mailtrain-org/mailtrain into transactional-mail-v2
This commit is contained in:
commit
e3e1e7a086
153 changed files with 10570 additions and 9267 deletions
|
@ -19,6 +19,10 @@ router.postAsync('/campaigns-others-by-list-table/:campaignId/:listIds', passpor
|
|||
return res.json(await campaigns.listOthersWhoseListsAreIncludedDTAjax(req.context, castToInteger(req.params.campaignId), req.params.listIds.split(';').map(x => castToInteger(x)), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/campaigns-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await campaigns.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/campaigns-children/:campaignId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await campaigns.listChildrenDTAjax(req.context, castToInteger(req.params.campaignId), req.body));
|
||||
});
|
||||
|
|
|
@ -11,6 +11,10 @@ router.postAsync('/lists-table', passport.loggedIn, async (req, res) => {
|
|||
return res.json(await lists.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/lists-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await lists.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/lists-with-segment-by-campaign-table/:campaignId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await lists.listWithSegmentByCampaignDTAjax(req.context, castToInteger(req.params.campaignId), req.body));
|
||||
});
|
||||
|
|
|
@ -40,6 +40,10 @@ router.postAsync('/send-configurations-table', passport.loggedIn, async (req, re
|
|||
return res.json(await sendConfigurations.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/send-configurations-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await sendConfigurations.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/send-configurations-with-send-permission-table', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await sendConfigurations.listWithSendPermissionDTAjax(req.context, req.body));
|
||||
});
|
||||
|
|
|
@ -35,6 +35,10 @@ router.postAsync('/templates-table', passport.loggedIn, async (req, res) => {
|
|||
return res.json(await templates.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/templates-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await templates.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/template-test-send', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
const data = req.body;
|
||||
const result = await CampaignSender.testSend(req.context, data.listCid, data.subscriptionCid, data.campaignId, data.sendConfigurationId, data.html, data.text);
|
||||
|
|
|
@ -156,7 +156,6 @@ function getRouter(appType) {
|
|||
// This is a fallback to versafix-1 if the block thumbnail is not defined by the template
|
||||
router.use('/templates/:mosaicoTemplateId/edres', express.static(path.join(__dirname, '..', '..', 'client', 'static', 'mosaico', 'templates', 'versafix-1', 'edres')));
|
||||
|
||||
|
||||
fileHelpers.installUploadHandler(router, '/upload/:type/:entityId', files.ReplacementBehavior.RENAME, null, 'file', resp => {
|
||||
return {
|
||||
files: resp.files.map(f => ({name: f.name, url: f.url, size: f.size, thumbnailUrl: f.thumbnailUrl}))
|
||||
|
|
|
@ -183,7 +183,6 @@ async function _renderSubscribe(req, res, list, subscription) {
|
|||
const htmlRenderer = await tools.getTemplate(data.template, req.locale);
|
||||
|
||||
data.isWeb = true;
|
||||
data.needsJsWarning = true;
|
||||
|
||||
data.flashMessages = await captureFlashMessages(res);
|
||||
|
||||
|
@ -385,7 +384,6 @@ router.getAsync('/:lcid/manage/:ucid', passport.csrfProtection, async (req, res)
|
|||
const htmlRenderer = await tools.getTemplate(data.template, req.locale);
|
||||
|
||||
data.isWeb = true;
|
||||
data.needsJsWarning = true;
|
||||
data.isManagePreferences = true;
|
||||
data.flashMessages = await captureFlashMessages(res);
|
||||
|
||||
|
@ -435,7 +433,6 @@ router.getAsync('/:lcid/manage-address/:ucid', passport.csrfProtection, async (r
|
|||
const htmlRenderer = await tools.getTemplate(data.template, req.locale);
|
||||
|
||||
data.isWeb = true;
|
||||
data.needsJsWarning = true;
|
||||
data.isManagePreferences = true;
|
||||
data.flashMessages = await captureFlashMessages(res);
|
||||
|
||||
|
@ -535,7 +532,6 @@ router.getAsync('/:lcid/unsubscribe/:ucid', passport.csrfProtection, async (req,
|
|||
const htmlRenderer = await tools.getTemplate(data.template, req.locale);
|
||||
|
||||
data.isWeb = true;
|
||||
data.needsJsWarning = true;
|
||||
data.flashMessages = await captureFlashMessages(res);
|
||||
|
||||
res.send(htmlRenderer(data));
|
||||
|
@ -679,7 +675,7 @@ async function webNotice(type, req, res) {
|
|||
}
|
||||
};
|
||||
|
||||
await injectCustomFormData(req.query.fid || list.default_form, 'web_' + type + '_notice', data);
|
||||
await injectCustomFormData(req.query.fid || list.default_form, 'web_' + type.replace('-', '_') + '_notice', data);
|
||||
|
||||
const htmlRenderer = await tools.getTemplate(data.template, req.locale);
|
||||
|
||||
|
|
|
@ -10,8 +10,16 @@ const stringify = require('csv-stringify')
|
|||
const fields = require('../models/fields');
|
||||
const lists = require('../models/lists');
|
||||
const moment = require('moment');
|
||||
const {SubscriptionStatus} = require('../../shared/lists');
|
||||
|
||||
router.getAsync('/export/:listId/:segmentId', passport.loggedIn, async (req, res) => {
|
||||
const statusStrings = {
|
||||
[SubscriptionStatus.SUBSCRIBED]: 'subscribed',
|
||||
[SubscriptionStatus.UNSUBSCRIBED]: 'unsubscribed',
|
||||
[SubscriptionStatus.BOUNCED]: 'bounced',
|
||||
[SubscriptionStatus.COMPLAINED]: 'complained'
|
||||
};
|
||||
|
||||
const listId = castToInteger(req.params.listId);
|
||||
const segmentId = castToInteger(req.params.segmentId);
|
||||
|
||||
|
@ -19,6 +27,7 @@ router.getAsync('/export/:listId/:segmentId', passport.loggedIn, async (req, res
|
|||
|
||||
const columns = [
|
||||
{key: 'cid', header: 'cid'},
|
||||
{key: 'status', header: 'status'},
|
||||
{key: 'hash_email', header: 'HASH_EMAIL'},
|
||||
{key: 'email', header: 'EMAIL'},
|
||||
];
|
||||
|
@ -50,6 +59,8 @@ router.getAsync('/export/:listId/:segmentId', passport.loggedIn, async (req, res
|
|||
stringifier.pipe(res);
|
||||
|
||||
for await (const subscription of subscriptions.listIterator(req.context, listId, segmentId, false)) {
|
||||
subscription.status = statusStrings[subscription.status];
|
||||
|
||||
stringifier.write(subscription);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue