mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 23:37:43 +03:00
Replaced i18n.t w/ tpl in class Invites (#13506)
refs: #13380 - The i18n package is deprecated. It is being replaced with the tpl package. Co-authored-by: Aleksander Chromik <aleksander.chromik@footballco.com>
This commit is contained in:
parent
1ceab9dea3
commit
36a2569370
@ -1,5 +1,5 @@
|
||||
const settingsCache = require('../../../shared/settings-cache');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const mailService = require('../../services/mail');
|
||||
const logging = require('@tryghost/logging');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
@ -7,7 +7,7 @@ const Invites = require('./invites');
|
||||
|
||||
module.exports = new Invites({
|
||||
settingsCache,
|
||||
i18n,
|
||||
tpl,
|
||||
logging,
|
||||
mailService,
|
||||
urlUtils
|
||||
|
@ -1,9 +1,17 @@
|
||||
const security = require('@tryghost/security');
|
||||
|
||||
const messages = {
|
||||
invitedByName: '{invitedByName} has invited you to join {blogName}',
|
||||
errorSendingEmail: {
|
||||
error: 'Error sending email: {message}',
|
||||
help: 'Please check your email settings and resend the invitation.'
|
||||
}
|
||||
};
|
||||
|
||||
class Invites {
|
||||
constructor({settingsCache, i18n, logging, mailService, urlUtils}) {
|
||||
constructor({settingsCache, tpl, logging, mailService, urlUtils}) {
|
||||
this.settingsCache = settingsCache;
|
||||
this.i18n = i18n;
|
||||
this.tpl = tpl;
|
||||
this.logging = logging;
|
||||
this.mailService = mailService;
|
||||
this.urlUtils = urlUtils;
|
||||
@ -44,7 +52,7 @@ class Invites {
|
||||
mail: [{
|
||||
message: {
|
||||
to: invite.get('email'),
|
||||
subject: this.i18n.t('common.api.users.mail.invitedByName', {
|
||||
subject: this.tpl(messages.invitedByName, {
|
||||
invitedByName: emailData.invitedByName,
|
||||
blogName: emailData.blogName
|
||||
}),
|
||||
@ -67,10 +75,10 @@ class Invites {
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err && err.errorType === 'EmailError') {
|
||||
const errorMessage = this.i18n.t('errors.api.invites.errorSendingEmail.error', {
|
||||
const errorMessage = this.tpl(messages.errorSendingEmail.error, {
|
||||
message: err.message
|
||||
});
|
||||
const helpText = this.i18n.t('errors.api.invites.errorSendingEmail.help');
|
||||
const helpText = this.tpl(messages.errorSendingEmail.help);
|
||||
err.message = `${errorMessage} ${helpText}`;
|
||||
this.logging.warn(err.message);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user