0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Replaced i18n.t w/ tpl helper in permissions (#13419)

refs: #13380

The i18n package is deprecated. It is being replaced with the tpl package.

Co-authored-by: Kenneth Fitzgerald <fitzgeraldkd@gmail.com>
This commit is contained in:
Kenneth Fitzgerald 2021-10-04 04:58:42 -04:00 committed by GitHub
parent 1e73f0b07a
commit 31b998e1e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,13 @@ const debug = require('@tryghost/debug')('api:canary: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
});