Obsoleting some old files
Transition to SPA-style client Basis for Mosaico template editor
This commit is contained in:
parent
7750232716
commit
c85f2d4440
942 changed files with 86311 additions and 967 deletions
|
@ -1,22 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
let lists = require('./models/lists');
|
||||
let fields = require('./models/fields');
|
||||
let _ = require('./translate')._;
|
||||
|
||||
module.exports = {
|
||||
getDefaultMergeTags,
|
||||
getRSSMergeTags,
|
||||
getListMergeTags,
|
||||
rollbackAndReleaseConnection,
|
||||
filterObject,
|
||||
enforce,
|
||||
cleanupFromPost
|
||||
cleanupFromPost,
|
||||
filterObject
|
||||
};
|
||||
|
||||
function getDefaultMergeTags(callback) {
|
||||
// Using a callback for the sake of future-proofness
|
||||
callback(null, [{
|
||||
function getDefaultMergeTags() {
|
||||
return [{
|
||||
key: 'LINK_UNSUBSCRIBE',
|
||||
value: _('URL that points to the unsubscribe page')
|
||||
}, {
|
||||
|
@ -28,15 +23,6 @@ function getDefaultMergeTags(callback) {
|
|||
}, {
|
||||
key: 'EMAIL',
|
||||
value: _('Email address')
|
||||
}, {
|
||||
key: 'FIRST_NAME',
|
||||
value: _('First name')
|
||||
}, {
|
||||
key: 'LAST_NAME',
|
||||
value: _('Last name')
|
||||
}, {
|
||||
key: 'FULL_NAME',
|
||||
value: _('Full name (first and last name combined)')
|
||||
}, {
|
||||
key: 'SUBSCRIPTION_ID',
|
||||
value: _('Unique ID that identifies the recipient')
|
||||
|
@ -46,12 +32,11 @@ function getDefaultMergeTags(callback) {
|
|||
}, {
|
||||
key: 'CAMPAIGN_ID',
|
||||
value: _('Unique ID that identifies current campaign')
|
||||
}]);
|
||||
}];
|
||||
}
|
||||
|
||||
function getRSSMergeTags(callback) {
|
||||
// Using a callback for the sake of future-proofness
|
||||
callback(null, [{
|
||||
function getRSSMergeTags() {
|
||||
return [{
|
||||
key: 'RSS_ENTRY',
|
||||
value: _('content from an RSS entry')
|
||||
}, {
|
||||
|
@ -72,45 +57,17 @@ function getRSSMergeTags(callback) {
|
|||
}, {
|
||||
key: 'RSS_ENTRY_IMAGE_URL',
|
||||
value: _('RSS entry image URL')
|
||||
}]);
|
||||
}];
|
||||
}
|
||||
|
||||
function getListMergeTags(listId, callback) {
|
||||
lists.get(listId, (err, list) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
if (!list) {
|
||||
list = {
|
||||
id: listId
|
||||
};
|
||||
}
|
||||
|
||||
fields.list(list.id, (err, fieldList) => {
|
||||
if (err && !fieldList) {
|
||||
fieldList = [];
|
||||
}
|
||||
|
||||
let mergeTags = [];
|
||||
|
||||
fieldList.forEach(field => {
|
||||
mergeTags.push({
|
||||
key: field.key,
|
||||
value: field.name
|
||||
});
|
||||
});
|
||||
|
||||
return callback(null, mergeTags);
|
||||
});
|
||||
});
|
||||
function enforce(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME - remove once we get rid of non-async models
|
||||
function rollbackAndReleaseConnection(connection, callback) {
|
||||
connection.rollback(() => {
|
||||
connection.release();
|
||||
return callback();
|
||||
});
|
||||
function cleanupFromPost(value) {
|
||||
return (value || '').toString().trim();
|
||||
}
|
||||
|
||||
function filterObject(obj, allowedKeys) {
|
||||
|
@ -122,14 +79,4 @@ function filterObject(obj, allowedKeys) {
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function enforce(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
function cleanupFromPost(value) {
|
||||
return (value || '').toString().trim();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue