Replaced i18n.t w/ tpl in api/v3/utils/validators/input/invites.js (#13514)

refs: #13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
william chandra 2021-10-11 19:58:53 +07:00 committed by GitHub
parent 6dcad04dcc
commit e0b08c1ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,19 @@
const Promise = require('bluebird');
const i18n = require('../../../../../../shared/i18n');
const tpl = require('@tryghost/tpl');
const errors = require('@tryghost/errors');
const models = require('../../../../../models');
const messages = {
userAlreadyRegistered: 'User is already registered.'
};
module.exports = {
add(apiConfig, frame) {
return models.User.findOne({email: frame.data.invites[0].email}, frame.options)
.then((user) => {
if (user) {
return Promise.reject(new errors.ValidationError({
message: i18n.t('errors.api.users.userAlreadyRegistered')
message: tpl(messages.userAlreadyRegistered)
}));
}
});