Merge branch 'master' of github.com:Mailtrain-org/mailtrain
Conflicts: languages/de_DE.po
This commit is contained in:
commit
11990d62b2
10 changed files with 743 additions and 362 deletions
|
@ -6,7 +6,8 @@ let templates = require('../lib/models/templates');
|
|||
let campaigns = require('../lib/models/campaigns');
|
||||
|
||||
module.exports = {
|
||||
getResource
|
||||
getResource,
|
||||
getMergeTagsForResource
|
||||
};
|
||||
|
||||
function getResource(type, id, callback) {
|
||||
|
@ -53,7 +54,7 @@ function getMergeTagsForResource(resource, callback) {
|
|||
return callback(err.message || err);
|
||||
}
|
||||
|
||||
if (!resource.list) {
|
||||
if (!Number(resource.list)) {
|
||||
return callback(null, defaultMergeTags);
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,17 @@ function getMergeTagsForResource(resource, callback) {
|
|||
return callback(err.message || err);
|
||||
}
|
||||
|
||||
callback(null, defaultMergeTags.concat(listMergeTags));
|
||||
if (resource.type !== 2) {
|
||||
return callback(null, defaultMergeTags.concat(listMergeTags));
|
||||
}
|
||||
|
||||
helpers.getRSSMergeTags((err, rssMergeTags) => {
|
||||
if (err) {
|
||||
return callback(err.message || err);
|
||||
}
|
||||
|
||||
callback(null, defaultMergeTags.concat(listMergeTags, rssMergeTags));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -50,7 +50,9 @@ module.exports.fetch = (url, callback) => {
|
|||
date: item.date || item.pubdate || item.pubDate || new Date(),
|
||||
guid: item.guid || item.link,
|
||||
link: item.link,
|
||||
content: item.description || item.summary
|
||||
content: item.description || item.summary,
|
||||
summary: item.summary || item.description,
|
||||
image_url: item.image.url
|
||||
};
|
||||
entries.push(entry);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ let hbs = require('hbs');
|
|||
|
||||
module.exports = {
|
||||
getDefaultMergeTags,
|
||||
getRSSMergeTags,
|
||||
getListMergeTags,
|
||||
captureFlashMessages,
|
||||
injectCustomFormData,
|
||||
|
@ -60,6 +61,32 @@ function getDefaultMergeTags(callback) {
|
|||
}]);
|
||||
}
|
||||
|
||||
function getRSSMergeTags(callback) {
|
||||
// Using a callback for the sake of future-proofness
|
||||
callback(null, [{
|
||||
key: 'RSS_ENTRY',
|
||||
value: _('content from an RSS entry')
|
||||
}, {
|
||||
key: 'RSS_ENTRY_TITLE',
|
||||
value: _('RSS entry title')
|
||||
}, {
|
||||
key: 'RSS_ENTRY_DATE',
|
||||
value: _('RSS entry date')
|
||||
}, {
|
||||
key: 'RSS_ENTRY_LINK',
|
||||
value: _('RSS entry link')
|
||||
}, {
|
||||
key: 'RSS_ENTRY_CONTENT',
|
||||
value: _('content from an RSS entry')
|
||||
}, {
|
||||
key: 'RSS_ENTRY_SUMMARY',
|
||||
value: _('RSS entry summary')
|
||||
}, {
|
||||
key: 'RSS_ENTRY_IMAGE_URL',
|
||||
value: _('RSS entry image URL')
|
||||
}]);
|
||||
}
|
||||
|
||||
function getListMergeTags(listId, callback) {
|
||||
lists.get(listId, (err, list) => {
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue