mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Replaced i18n.t w/ tpl in core/server/api/v3/utils/validators/input/webhooks.js (#13536)
refs: TryGhost#13380 - The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
parent
1f2ce40fed
commit
91dd9eae4e
1 changed files with 8 additions and 3 deletions
|
@ -1,16 +1,21 @@
|
|||
const _ = require('lodash');
|
||||
const errors = require('@tryghost/errors');
|
||||
const i18n = require('../../../../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const jsonSchema = require('../utils/json-schema');
|
||||
|
||||
const messages = {
|
||||
schemaValidationFailed: 'Validation failed for \'{key}\'.',
|
||||
noIntegrationIdProvidedContext: 'You may only create webhooks with \'integration_id\' when using session authentication.'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
add(apiConfig, frame) {
|
||||
if (!_.get(frame, 'options.context.integration.id') && !_.get(frame.data, 'webhooks[0].integration_id')) {
|
||||
return Promise.reject(new errors.ValidationError({
|
||||
message: i18n.t('notices.data.validation.index.schemaValidationFailed', {
|
||||
message: tpl(messages.schemaValidationFailed, {
|
||||
key: 'integration_id'
|
||||
}),
|
||||
context: i18n.t('errors.api.webhooks.noIntegrationIdProvided.context'),
|
||||
context: tpl(messages.noIntegrationIdProvidedContext),
|
||||
property: 'integration_id'
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue