mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Replace the dependency i18n with tpl in permissions.js files (#13448)
refs: #13380 The i18n package is deprecated. It is being replaced with the tpl package. The files changed are under `core/server/api/v2` and `core/server/api/v3`.
This commit is contained in:
parent
22546d55e8
commit
8338be3aca
2 changed files with 12 additions and 4 deletions
|
@ -2,9 +2,13 @@ const debug = require('@tryghost/debug')('api:v2:utils:permissions');
|
|||
const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const permissions = require('../../../services/permissions');
|
||||
const i18n = require('../../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
const messages = {
|
||||
noPermissionToCall: 'You do not have permission to {method} {docName}'
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Handle requests, which need authentication.
|
||||
*
|
||||
|
@ -51,7 +55,7 @@ const nonePublicAuth = (apiConfig, frame) => {
|
|||
}
|
||||
}).catch((err) => {
|
||||
if (err instanceof errors.NoPermissionError) {
|
||||
err.message = i18n.t('errors.api.utils.noPermissionToCall', {
|
||||
err.message = tpl(messages.noPermissionToCall, {
|
||||
method: apiConfig.method,
|
||||
docName: apiConfig.docName
|
||||
});
|
||||
|
|
|
@ -2,9 +2,13 @@ const debug = require('@tryghost/debug')('api:v3:utils:permissions');
|
|||
const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const permissions = require('../../../services/permissions');
|
||||
const i18n = require('../../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
const messages = {
|
||||
noPermissionToCall: 'You do not have permission to {method} {docName}'
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Handle requests, which need authentication.
|
||||
*
|
||||
|
@ -55,7 +59,7 @@ const nonePublicAuth = (apiConfig, frame) => {
|
|||
}
|
||||
}).catch((err) => {
|
||||
if (err instanceof errors.NoPermissionError) {
|
||||
err.message = i18n.t('errors.api.utils.noPermissionToCall', {
|
||||
err.message = tpl(messages.noPermissionToCall, {
|
||||
method: apiConfig.method,
|
||||
docName: apiConfig.docName
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue