Replaced i18n.t w/ tpl in invites.js for canary

refs: TryGhost#13380

- The i18n package is deprecated. It is being replaced with the tpl package.
This commit is contained in:
Ozan Uslan 2021-10-06 01:24:41 +03:00 committed by Hannah Wolfe
parent 027e25a47f
commit 68de391c98

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