diff --git a/public/language/en-GB/email.json b/public/language/en-GB/email.json index 378dd84b38..813ba0f2ce 100644 --- a/public/language/en-GB/email.json +++ b/public/language/en-GB/email.json @@ -1,5 +1,6 @@ { - "password-reset-requested": "Password Reset Requested - %1!", + "test-email.subject": "Test Email", + "password-reset-requested": "Password Reset Requested!", "welcome-to": "Welcome to %1", "invite": "Invitation from %1", diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index a3787099be..4077967ad9 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -249,7 +249,7 @@ SocketAdmin.settings.clearSitemapCache = function (socket, data, callback) { SocketAdmin.email.test = function (socket, data, callback) { var payload = { - subject: 'Test Email', + subject: '[[email:test-email.subject]]', }; switch (data.template) { diff --git a/src/user/approval.js b/src/user/approval.js index f4cd14fc3b..c890c4abf4 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -1,4 +1,3 @@ - 'use strict'; var async = require('async'); @@ -11,7 +10,6 @@ var meta = require('../meta'); var emailer = require('../emailer'); var notifications = require('../notifications'); var groups = require('../groups'); -var translator = require('../translator'); var utils = require('../utils'); var plugins = require('../plugins'); @@ -114,16 +112,14 @@ module.exports = function (User) { }, function (next) { var title = meta.config.title || meta.config.browserTitle || 'NodeBB'; - translator.translate('[[email:welcome-to, ' + title + ']]', meta.config.defaultLang, function (subject) { - var data = { - username: username, - subject: subject, - template: 'registration_accepted', - uid: uid, - }; + var data = { + username: username, + subject: '[[email:welcome-to, ' + title + ']]', + template: 'registration_accepted', + uid: uid, + }; - emailer.send('registration_accepted', uid, data, next); - }); + emailer.send('registration_accepted', uid, data, next); }, function (next) { next(null, uid); diff --git a/src/user/email.js b/src/user/email.js index 571d55f9fb..99c267583b 100644 --- a/src/user/email.js +++ b/src/user/email.js @@ -6,7 +6,6 @@ var nconf = require('nconf'); var user = require('../user'); var utils = require('../utils'); -var translator = require('../translator'); var plugins = require('../plugins'); var db = require('../database'); var meta = require('../meta'); @@ -100,26 +99,24 @@ UserEmail.sendValidationEmail = function (uid, options, callback) { }, function (username, next) { var title = meta.config.title || meta.config.browserTitle || 'NodeBB'; - var subject = options.subject || '[[email:welcome-to, ' + title + ']]'; var template = options.template || 'welcome'; - translator.translate(subject, meta.config.defaultLang, function (subject) { - var data = { - username: username, - confirm_link: confirm_link, - confirm_code: confirm_code, - - subject: subject, - template: template, - uid: uid, - }; - - if (plugins.hasListeners('action:user.verify')) { - plugins.fireHook('action:user.verify', { uid: uid, data: data }); - next(); - } else { - emailer.send(template, uid, data, next); - } - }); + + var data = { + username: username, + confirm_link: confirm_link, + confirm_code: confirm_code, + + subject: options.subject || '[[email:welcome-to, ' + title + ']]', + template: template, + uid: uid, + }; + + if (plugins.hasListeners('action:user.verify')) { + plugins.fireHook('action:user.verify', { uid: uid, data: data }); + next(); + } else { + emailer.send(template, uid, data, next); + } }, function (next) { next(null, confirm_code); diff --git a/src/user/reset.js b/src/user/reset.js index 4dc76a8c16..a9864d82d6 100644 --- a/src/user/reset.js +++ b/src/user/reset.js @@ -6,7 +6,6 @@ var winston = require('winston'); var user = require('../user'); var utils = require('../utils'); -var translator = require('../translator'); var batch = require('../batch'); var db = require('../database'); @@ -79,15 +78,9 @@ UserReset.send = function (email, callback) { UserReset.generate(uid, next); }, function (code, next) { - translator.translate('[[email:password-reset-requested, ' + (meta.config.title || 'NodeBB') + ']]', meta.config.defaultLang, function (subject) { - next(null, subject, code); - }); - }, - function (subject, code, next) { - var reset_link = nconf.get('url') + '/reset/' + code; emailer.send('reset', uid, { - reset_link: reset_link, - subject: subject, + reset_link: nconf.get('url') + '/reset/' + code, + subject: '[[email:password-reset-requested]]', template: 'reset', uid: uid, }, next);