0
Fork 0
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:
Indrakant Dana 2021-10-12 01:24:06 +05:30 committed by GitHub
parent 1f2ce40fed
commit 91dd9eae4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'
}));
}