0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Replaced i18n.t w/ tpl helper in mail.js

refs #13380
- this is a refactor to do everywhere
This commit is contained in:
Guillaume 2021-10-04 16:50:53 +02:00 committed by Hannah Wolfe
parent 4f406318a9
commit 1cd1ae36bf

View file

@ -1,10 +1,16 @@
const Promise = require('bluebird'); const Promise = require('bluebird');
const i18n = require('../../../shared/i18n'); const tpl = require('@tryghost/tpl');
const mailService = require('../../services/mail'); const mailService = require('../../services/mail');
const api = require('./'); const api = require('./');
let mailer; let mailer;
let _private = {}; let _private = {};
const messages = {
unableToSendEmail: 'Ghost is currently unable to send email.',
seeLinkForInstructions: 'See {link} for instructions.',
testGhostEmail: 'Test Ghost Email'
};
_private.sendMail = (object) => { _private.sendMail = (object) => {
if (!(mailer instanceof mailService.GhostMailer)) { if (!(mailer instanceof mailService.GhostMailer)) {
mailer = new mailService.GhostMailer(); mailer = new mailService.GhostMailer();
@ -17,8 +23,8 @@ _private.sendMail = (object) => {
notifications: [{ notifications: [{
type: 'warn', type: 'warn',
message: [ message: [
i18n.t('warnings.index.unableToSendEmail'), tpl(messages.unableToSendEmail),
i18n.t('common.seeLinkForInstructions', {link: 'https://ghost.org/docs/concepts/config/#mail'}) tpl(messages.seeLinkForInstructions, {link: 'https://ghost.org/docs/concepts/config/#mail'})
].join(' ') ].join(' ')
}] }]
}, },
@ -47,7 +53,7 @@ module.exports = {
mail: [{ mail: [{
message: { message: {
to: frame.user.get('email'), to: frame.user.get('email'),
subject: i18n.t('common.api.mail.testGhostEmail'), subject: tpl(messages.testGhostEmail),
html: content.html, html: content.html,
text: content.text text: content.text
} }