From a2627d20667353d55a7dbf77836a8907858b1670 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 13 Jul 2017 11:30:44 -0400 Subject: [PATCH] added default payload to emails, and adding nodebb logo for email header --- public/images/emails/nodebb.png | Bin 0 -> 6285 bytes src/emailer.js | 10 ++++++++++ src/messaging/notifications.js | 2 -- src/socket.io/admin.js | 2 -- src/socket.io/user.js | 1 - src/socket.io/user/ban.js | 1 - src/topics/follow.js | 1 - src/user/approval.js | 1 - src/user/digest.js | 2 -- src/user/email.js | 1 - src/user/reset.js | 1 - src/views/emails/welcome.tpl | 14 ++++++++++++-- 12 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 public/images/emails/nodebb.png diff --git a/public/images/emails/nodebb.png b/public/images/emails/nodebb.png new file mode 100644 index 0000000000000000000000000000000000000000..11ac9507adaccf6d55a7267f4648adc2cfca9dbc GIT binary patch literal 6285 zcmbVwWmFVS*!|M6($XE$ExE7)(g-YF!qQ52_fktE(p>_JNJt2h3#cH{p@75!A_&MX zy-2;izS#2LOce0st}b0KmU{C}tM`2owhZ_Ur%vPyqly?^Duk zsCZu>baz?of*y1oaA0<`tiiPnhdDY+?mWGZ^^ z9Ug0|shET;|1AwIuu;!NMxTL7;}5RZBse&TdB?lb)ClGcC1QGFflVAK91n&O?4T5` zNiIRqP!e$Ki+J27$6`9SKFh-&mx&epIweV*3YJ9&&w>XYN0)S?7kbdE-JLz&!F5}g zk?Y^~dxLEkJ_hcal!EH$#2*a*-zH*9!wTT&lcaUL!(gY_!oKT2$@aHg@cfr1l>k8* zxiEePkv^_IAsyfcPA6W01M?UAj3f>&zNAqRuH%X%5Be;q>n~9Bs#dCd8l~gCRrPu= zafr>Y@cpv8PxWc-0F41gg;`t%xNPlwqHnytjwgdA!~e&&Ix~)2B*r(yQ3w3b0(hF% zPWffyTg&(jIURi$%9H><(OcRuk!91_Ue5XJDc6B;jkzFdh0~B3)|K!+4+5o-=(SkQUt8XD_2|HE{|1{ZXH>6DZ*S1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H#^aVe0vxNJBD@_z|D zy`5ZNg#IUx`cEKvFOUH}mIg`4{6B$-7zx?EfaSj%jJ;n31l#*L15}*69h^BdT>YGb cz5U$%IaG~hc6(dX?s))hb$zv_r*^Ub1F$^g2LJ#7 literal 0 HcmV?d00001 diff --git a/src/emailer.js b/src/emailer.js index 38d68102c1..5120ef9caf 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -25,10 +25,17 @@ var fallbackTransport; var Emailer = module.exports; +Emailer._defaultPayload = {}; Emailer.registerApp = function (expressApp) { app = expressApp; + Emailer._defaultPayload = { + url: nconf.get('url'), + site_title: meta.config.title || 'NodeBB', + 'brand:logo': nconf.get('url') + meta.config['brand:logo'], + }; + // Enable Gmail transport if enabled in ACP if (parseInt(meta.config['email:GmailTransport:enabled'], 10) === 1) { transports.gmail = nodemailer.createTransport(smtpTransport({ @@ -55,6 +62,9 @@ Emailer.send = function (template, uid, params, callback) { return callback(); } + // Combined passed-in payload with default values + params = Object.assign({}, Emailer._defaultPayload, params); + async.waterfall([ function (next) { async.parallel({ diff --git a/src/messaging/notifications.js b/src/messaging/notifications.js index 5d433b2c33..12640def03 100644 --- a/src/messaging/notifications.js +++ b/src/messaging/notifications.js @@ -124,8 +124,6 @@ module.exports = function (Messaging) { subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]', summary: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]', message: messageObj, - site_title: meta.config.title || 'NodeBB', - url: nconf.get('url'), roomId: messageObj.roomId, username: userData.username, userslug: userData.userslug, diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index 6f1345afdd..304fdd831c 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -228,8 +228,6 @@ SocketAdmin.email.test = function (socket, data, callback) { var site_title = meta.config.title || 'NodeBB'; var payload = { subject: '[' + site_title + '] Test Email', - site_title: site_title, - url: nconf.get('url'), }; switch (data.template) { diff --git a/src/socket.io/user.js b/src/socket.io/user.js index d59fad3c58..1ed67276c4 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -128,7 +128,6 @@ SocketUser.reset.commit = function (socket, data, callback) { emailer.send('reset_notify', uid, { username: username, date: parsedDate, - site_title: meta.config.title || 'NodeBB', subject: '[[email:reset.notify.subject]]', }); diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js index d6cfbd6f68..a61a9b83ee 100644 --- a/src/socket.io/user/ban.js +++ b/src/socket.io/user/ban.js @@ -107,7 +107,6 @@ module.exports = function (SocketUser) { var siteTitle = meta.config.title || 'NodeBB'; var data = { subject: '[[email:banned.subject, ' + siteTitle + ']]', - site_title: siteTitle, username: username, until: until ? utils.toISOString(until) : false, reason: reason, diff --git a/src/topics/follow.js b/src/topics/follow.js index 89db6b3d13..62ee424eea 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -259,7 +259,6 @@ module.exports = function (Topics) { subject: '[' + (meta.config.title || 'NodeBB') + '] ' + title, intro: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]', postBody: postData.content.replace(/"\/\//g, '"https://'), - site_title: meta.config.title || 'NodeBB', username: data.userData.username, userslug: data.userData.userslug, url: nconf.get('url') + '/topic/' + postData.topic.tid, diff --git a/src/user/approval.js b/src/user/approval.js index d04686a7b0..4beeab6806 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -89,7 +89,6 @@ module.exports = function (User) { var title = meta.config.title || meta.config.browserTitle || 'NodeBB'; translator.translate('[[email:welcome-to, ' + title + ']]', meta.config.defaultLang, function (subject) { var data = { - site_title: title, username: username, subject: subject, template: 'registration_accepted', diff --git a/src/user/digest.js b/src/user/digest.js index 61b727de3a..ffd4f9031e 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -136,8 +136,6 @@ Digest.send = function (data, callback) { subject: '[' + meta.config.title + '] [[email:digest.subject, ' + (now.getFullYear() + '/' + (now.getMonth() + 1) + '/' + now.getDate()) + ']]', username: userObj.username, userslug: userObj.userslug, - url: nconf.get('url'), - site_title: meta.config.title || meta.config.browserTitle || 'NodeBB', notifications: notifications, recent: data.topics, interval: data.interval, diff --git a/src/user/email.js b/src/user/email.js index 734e247eb1..9c61211d9a 100644 --- a/src/user/email.js +++ b/src/user/email.js @@ -102,7 +102,6 @@ UserEmail.sendValidationEmail = function (uid, options, callback) { var title = meta.config.title || meta.config.browserTitle || 'NodeBB'; translator.translate('[[email:welcome-to, ' + title + ']]', meta.config.defaultLang, function (subject) { var data = { - site_title: title, username: username, confirm_link: confirm_link, confirm_code: confirm_code, diff --git a/src/user/reset.js b/src/user/reset.js index 438d629225..2aaa1d76bb 100644 --- a/src/user/reset.js +++ b/src/user/reset.js @@ -85,7 +85,6 @@ UserReset.send = function (email, callback) { function (subject, code, next) { var reset_link = nconf.get('url') + '/reset/' + code; emailer.send('reset', uid, { - site_title: (meta.config.title || 'NodeBB'), reset_link: reset_link, subject: subject, template: 'reset', diff --git a/src/views/emails/welcome.tpl b/src/views/emails/welcome.tpl index 3ac45b06cd..6f126a7754 100644 --- a/src/views/emails/welcome.tpl +++ b/src/views/emails/welcome.tpl @@ -173,12 +173,22 @@ + + + + + +
+ alt_text +
+ + - @@ -186,7 +196,7 @@ -
+ alt_text
+