Node.js based forum software built for the modern web
added default payload to emails, and adding nodebb logo for email header
Julian Lama2627d206673
diff --git a/public/images/emails/nodebb.png b/public/images/emails/nodebb.pngnew file mode 100644index 0000000000..11ac9507adBinary files /dev/null and b/public/images/emails/nodebb.png differdiff --git a/src/emailer.js b/src/emailer.jsindex 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 ACPif (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.jsindex 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.jsindex 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.jsindex 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.jsindex 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.jsindex 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.jsindex 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.jsindex 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.jsindex 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.jsindex 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.tplindex 3ac45b06cd..6f126a7754 100644--- a/src/views/emails/welcome.tpl+++ b/src/views/emails/welcome.tpl@@ -173,12 +173,22 @@<td><![endif]-->+ <!-- Email Header : BEGIN -->+ <table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 600px;">+ <tr>+ <td style="padding: 20px 0; text-align: center">+ <img src="http://juliantest.nodebb.com/assets/images/emails/nodebb.png" height="100" width="245" alt="alt_text" border="0" style="height: auto; background: #dddddd; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">+ </td>+ </tr>+ </table>+ <!-- Email Header : END -->+<!-- Email Body : BEGIN --><table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 600px;"><!-- Hero Image, Flush : BEGIN --><tr>- <td bgcolor="#ffffff" style="text-align: center; background-image: url(http://juliantest.nodebb.com/assets/images/emails/triangularbackground.png); background-size: cover; background-repeat: no-repeat;">+ <td bgcolor="#efeff0" style="text-align: center; background-image: url(http://juliantest.nodebb.com/assets/images/emails/triangularbackground.png); background-size: cover; background-repeat: no-repeat;"><img src="http://juliantest.nodebb.com/assets/images/emails/emailconfirm.png" width="600" height="" alt="alt_text" border="0" align="center" style="width: 50%; max-width: 600px; height: auto; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;" class="g-img"></td></tr>@@ -186,7 +196,7 @@<!-- 1 Column Text + Button : BEGIN --><tr>- <td bgcolor="#ffffff">+ <td bgcolor="#efeff0"><table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td style="padding: 40px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;">