do not translate email subjects twice, emailer already translates the passed in subject param
v1.18.x
Barış Soner Uşaklı 6 years ago
parent 00a066985a
commit 2c5e38d8f1

@ -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",

@ -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) {

@ -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);

@ -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);

@ -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);

Loading…
Cancel
Save