Added CSV export of subscribers
Fixed some bugs in subscriptions Updated some packages to avoid warnings about vulnerabilities Completed RSS feed campaigns
This commit is contained in:
parent
8683f8c91e
commit
bf69e633c4
47 changed files with 5255 additions and 9651 deletions
|
@ -11,7 +11,7 @@ const lists = require('../models/lists');
|
|||
const fields = require('../models/fields');
|
||||
const sendConfigurations = require('../models/send-configurations');
|
||||
const links = require('../models/links');
|
||||
const {CampaignSource} = require('../shared/campaigns');
|
||||
const {CampaignSource, CampaignType} = require('../shared/campaigns');
|
||||
const {SubscriptionStatus} = require('../shared/lists');
|
||||
const tools = require('../lib/tools');
|
||||
const request = require('request-promise');
|
||||
|
@ -68,7 +68,7 @@ class CampaignSender {
|
|||
return prefix + 'cid:' + cid;
|
||||
});
|
||||
|
||||
html = tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, html, false, true);
|
||||
html = tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, html, true);
|
||||
|
||||
text = (text || '').trim()
|
||||
? tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, text)
|
||||
|
@ -91,7 +91,7 @@ class CampaignSender {
|
|||
replyTo: getOverridable('reply_to'),
|
||||
xMailer: sendConfiguration.x_mailer ? sendConfiguration.x_mailer : false,
|
||||
to: {
|
||||
name: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, list.to_name, false, false),
|
||||
name: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, list.to_name, false),
|
||||
address: subscriptionGrouped.email
|
||||
},
|
||||
sender: this.useVerpSenderHeader ? campaignAddress + '@' + sendConfiguration.verp_hostname : false,
|
||||
|
@ -125,7 +125,7 @@ class CampaignSender {
|
|||
list: {
|
||||
unsubscribe: null
|
||||
},
|
||||
subject: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, getOverridable('subject'), false, false),
|
||||
subject: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, getOverridable('subject'), false),
|
||||
html,
|
||||
text,
|
||||
|
||||
|
@ -240,7 +240,7 @@ class CampaignSender {
|
|||
});
|
||||
}
|
||||
|
||||
html = renderTags ? tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, html, false, true) : html;
|
||||
html = renderTags ? tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, html, true) : html;
|
||||
|
||||
text = (text || '').trim()
|
||||
? (renderTags ? tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, text) : text)
|
||||
|
@ -253,12 +253,28 @@ class CampaignSender {
|
|||
};
|
||||
}
|
||||
|
||||
_getExtraTags(campaign) {
|
||||
const tags = {};
|
||||
|
||||
if (campaign.type === CampaignType.RSS_ENTRY) {
|
||||
const rssEntry = campaign.data.rssEntry;
|
||||
tags['RSS_ENTRY_TITLE'] = rssEntry.title;
|
||||
tags['RSS_ENTRY_DATE'] = rssEntry.date;
|
||||
tags['RSS_ENTRY_LINK'] = rssEntry.link;
|
||||
tags['RSS_ENTRY_CONTENT'] = rssEntry.content;
|
||||
tags['RSS_ENTRY_SUMMARY'] = rssEntry.summary;
|
||||
tags['RSS_ENTRY_IMAGE_URL'] = rssEntry.image_url;
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
async getMessage(listCid, subscriptionCid) {
|
||||
const list = this.listsByCid.get(listCid);
|
||||
const subscriptionGrouped = await subscriptions.getByCid(contextHelpers.getAdminContext(), list.id, subscriptionCid);
|
||||
const flds = this.listsFieldsGrouped.get(list.id);
|
||||
const campaign = this.campaign;
|
||||
const mergeTags = fields.getMergeTags(flds, subscriptionGrouped);
|
||||
const mergeTags = fields.getMergeTags(flds, subscriptionGrouped, this._getExtraTags(campaign));
|
||||
|
||||
return await this._getMessage(campaign, list, subscriptionGrouped, mergeTags, false);
|
||||
}
|
||||
|
@ -272,7 +288,8 @@ class CampaignSender {
|
|||
const subscriptionGrouped = await subscriptions.getByEmail(contextHelpers.getAdminContext(), list.id, email);
|
||||
const flds = this.listsFieldsGrouped.get(listId);
|
||||
const campaign = this.campaign;
|
||||
const mergeTags = fields.getMergeTags(flds, subscriptionGrouped);
|
||||
|
||||
const mergeTags = fields.getMergeTags(flds, subscriptionGrouped, this._getExtraTags(campaign));
|
||||
|
||||
const encryptionKeys = [];
|
||||
for (const fld of flds) {
|
||||
|
@ -314,7 +331,7 @@ class CampaignSender {
|
|||
replyTo: getOverridable('reply_to'),
|
||||
xMailer: sendConfiguration.x_mailer ? sendConfiguration.x_mailer : false,
|
||||
to: {
|
||||
name: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, list.to_name, false, false),
|
||||
name: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, list.to_name, false),
|
||||
address: subscriptionGrouped.email
|
||||
},
|
||||
sender: this.useVerpSenderHeader ? campaignAddress + '@' + sendConfiguration.verp_hostname : false,
|
||||
|
@ -348,7 +365,7 @@ class CampaignSender {
|
|||
list: {
|
||||
unsubscribe: listUnsubscribe
|
||||
},
|
||||
subject: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, getOverridable('subject'), false, false),
|
||||
subject: tools.formatMessage(campaign, list, subscriptionGrouped, mergeTags, getOverridable('subject'), false),
|
||||
html,
|
||||
text,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue