mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
chore: eslint prefer-template
This commit is contained in:
committed by
Julian Lam
parent
4ee0f1459d
commit
707b55b6a5
@@ -89,7 +89,7 @@ const buildCustomTemplates = async (config) => {
|
||||
Benchpress.flush();
|
||||
winston.verbose('[emailer] Built custom email templates');
|
||||
} catch (err) {
|
||||
winston.error('[emailer] Failed to build custom email templates\n' + err.stack);
|
||||
winston.error(`[emailer] Failed to build custom email templates\n${err.stack}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -105,9 +105,9 @@ Emailer.getTemplates = async (config) => {
|
||||
return {
|
||||
path: path,
|
||||
fullpath: email,
|
||||
text: config['email:custom:' + path] || original,
|
||||
text: config[`email:custom:${path}`] || original,
|
||||
original: original,
|
||||
isCustom: !!config['email:custom:' + path],
|
||||
isCustom: !!config[`email:custom:${path}`],
|
||||
};
|
||||
}));
|
||||
return templates;
|
||||
@@ -270,8 +270,8 @@ Emailer.sendToEmail = async (template, email, language, params) => {
|
||||
|
||||
const unsubUrl = [nconf.get('url'), 'email', 'unsubscribe', payload].join('/');
|
||||
params.headers = {
|
||||
'List-Id': '<' + [template, params.uid, getHostname()].join('.') + '>',
|
||||
'List-Unsubscribe': '<' + unsubUrl + '>',
|
||||
'List-Id': `<${[template, params.uid, getHostname()].join('.')}>`,
|
||||
'List-Unsubscribe': `<${unsubUrl}>`,
|
||||
'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',
|
||||
...params.headers,
|
||||
};
|
||||
@@ -297,9 +297,9 @@ Emailer.sendToEmail = async (template, email, language, params) => {
|
||||
const data = await Plugins.hooks.fire('filter:email.modify', {
|
||||
_raw: params,
|
||||
to: email,
|
||||
from: meta.config['email:from'] || 'no-reply@' + getHostname(),
|
||||
from: meta.config['email:from'] || `no-reply@${getHostname()}`,
|
||||
from_name: meta.config['email:from_name'] || 'NodeBB',
|
||||
subject: '[' + meta.config.title + '] ' + _.unescape(subject),
|
||||
subject: `[${meta.config.title}] ${_.unescape(subject)}`,
|
||||
html: html,
|
||||
plaintext: htmlToText(html, {
|
||||
tags: { img: { format: 'skip' } },
|
||||
@@ -333,15 +333,15 @@ Emailer.sendViaFallback = async (data) => {
|
||||
delete data.plaintext;
|
||||
|
||||
// NodeMailer uses a combined "from"
|
||||
data.from = data.from_name + '<' + data.from + '>';
|
||||
data.from = `${data.from_name}<${data.from}>`;
|
||||
delete data.from_name;
|
||||
|
||||
winston.verbose('[emailer] Sending email to uid ' + data.uid + ' (' + data.to + ')');
|
||||
winston.verbose(`[emailer] Sending email to uid ${data.uid} (${data.to})`);
|
||||
await Emailer.fallbackTransport.sendMail(data);
|
||||
};
|
||||
|
||||
Emailer.renderAndTranslate = async (template, params, lang) => {
|
||||
const html = await app.renderAsync('emails/' + template, params);
|
||||
const html = await app.renderAsync(`emails/${template}`, params);
|
||||
return await translator.translate(html, lang);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user