Replaced i18n.t with tpl in core/server/services/bulk-email and core/server/services/permissions (#13562)

refs: #13380

- i18n is deprecated and is being replaced with tpl
This commit is contained in:
PakkuDon 2021-10-13 00:46:35 +11:00 committed by GitHub
parent b48c16c118
commit 0fe62e3aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,7 @@ const _ = require('lodash');
const Promise = require('bluebird');
const moment = require('moment-timezone');
const errors = require('@tryghost/errors');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const logging = require('@tryghost/logging');
const models = require('../../models');
const mailgunProvider = require('./mailgun');
@ -10,6 +10,10 @@ const sentry = require('../../../shared/sentry');
const debug = require('@tryghost/debug')('mega');
const postEmailSerializer = require('../mega/post-email-serializer');
const messages = {
error: 'The email service was unable to send an email batch.'
};
const BATCH_SIZE = mailgunProvider.BATCH_SIZE;
/**
@ -239,7 +243,7 @@ module.exports = {
// REF: possible mailgun errors https://documentation.mailgun.com/en/latest/api-intro.html#errors
let ghostError = new errors.EmailError({
err: error,
context: i18n.t('errors.services.mega.requestFailed.error'),
context: tpl(messages.error),
code: 'BULK_EMAIL_SEND_FAILED'
});

View File

@ -1,10 +1,14 @@
const _ = require('lodash');
const Promise = require('bluebird');
const errors = require('@tryghost/errors');
const i18n = require('../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const parseContext = require('./parse-context');
const _private = {};
const messages = {
error: 'You do not have permission to retrieve {docName} with that status'
};
/**
* @TODO:
*
@ -17,7 +21,7 @@ const _private = {};
* - public context cannot fetch draft/scheduled posts
*/
_private.applyStatusRules = function applyStatusRules(docName, method, opts) {
const err = new errors.NoPermissionError({message: i18n.t('errors.permissions.applyStatusRules.error', {docName: docName})});
const err = new errors.NoPermissionError({message: tpl(messages.error, {docName: docName})});
// Enforce status 'active' for users
if (docName === 'users') {