[ST] syntax fixes

This commit is contained in:
Shamil Mingaliev 2019-12-13 16:32:17 +03:00
parent e55fa93d18
commit 13315b8b72
3 changed files with 14 additions and 16 deletions

View file

@ -353,14 +353,13 @@ module.exports.getWithMergeTags = (listId, cid, callback) => {
return fieldList = [];
}
subscription.mergeTags = {
subscription.mergeTags = Object.assign({
EMAIL: subscription.email,
FIRST_NAME: subscription.firstName,
LAST_NAME: subscription.lastName,
FULL_NAME: [].concat(subscription.firstName || []).concat(subscription.lastName || []).join(' '),
TIMEZONE: subscription.tz || '',
...tools.artstationMergeTags(subscription),
};
TIMEZONE: subscription.tz || ''
}, tools.artstationMergeTags(subscription));
fields.getRow(fieldList, subscription, false, true).forEach(field => {
if (field.mergeTag) {

View file

@ -326,13 +326,13 @@ function mergeTemplateIntoLayout(template, layout, callback) {
}
function artstationMergeTags(subscription) {
const iv = crypto.randomBytes(16)
const cipher = crypto.createCipheriv('aes-256-cbc', process.env.ARTSTATION_SECRET, iv)
let encrypted_email = cipher.update(subscription.email, 'utf8', 'hex')
encrypted_email += cipher.final('hex')
const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv('aes-256-cbc', process.env.ARTSTATION_SECRET, iv);
let encrypted_email = cipher.update(subscription.email, 'utf8', 'hex');
encrypted_email += cipher.final('hex');
return {
ENCRYPTED_EMAIL: encrypted_email,
IV: iv.toString('hex'),
}
return {
ENCRYPTED_EMAIL: encrypted_email,
IV: iv.toString('hex'),
};
}

View file

@ -324,13 +324,12 @@ function formatMessage(message, callback) {
return callback(err);
}
message.subscription.mergeTags = {
message.subscription.mergeTags = Object.assign({
EMAIL: message.subscription.email,
FIRST_NAME: message.subscription.firstName,
LAST_NAME: message.subscription.lastName,
FULL_NAME: [].concat(message.subscription.firstName || []).concat(message.subscription.lastName || []).join(' '),
...tools.artstationMergeTags(message.subscription),
};
FULL_NAME: [].concat(message.subscription.firstName || []).concat(message.subscription.lastName || []).join(' ')
}, tools.artstationMergeTags(message.subscription));
let encryptionKeys = [];
fields.getRow(fieldList, message.subscription, false, true).forEach(field => {