mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Replaced i18n.t w/ tpl helper in posts.js (#13455)
refs: #13380 The i18n package is deprecated. It is being replaced with the tpl package. Co-authored-by: thick-hollins <alexnuttall@zoho.eu>
This commit is contained in:
parent
e3b56dd99f
commit
162502b19e
1 changed files with 7 additions and 3 deletions
|
@ -1,10 +1,14 @@
|
|||
const models = require('../../models');
|
||||
const i18n = require('../../../shared/i18n');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
const errors = require('@tryghost/errors');
|
||||
const getPostServiceInstance = require('../../services/posts/posts-service');
|
||||
const allowedIncludes = ['tags', 'authors', 'authors.roles', 'email'];
|
||||
const unsafeAttrs = ['status', 'authors', 'visibility'];
|
||||
|
||||
const messages = {
|
||||
postNotFound: 'Post not found.'
|
||||
};
|
||||
|
||||
const postsService = getPostServiceInstance('canary');
|
||||
|
||||
module.exports = {
|
||||
|
@ -73,7 +77,7 @@ module.exports = {
|
|||
.then((model) => {
|
||||
if (!model) {
|
||||
throw new errors.NotFoundError({
|
||||
message: i18n.t('errors.api.posts.postNotFound')
|
||||
message: tpl(messages.postNotFound)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -188,7 +192,7 @@ module.exports = {
|
|||
.then(() => null)
|
||||
.catch(models.Post.NotFoundError, () => {
|
||||
return Promise.reject(new errors.NotFoundError({
|
||||
message: i18n.t('errors.api.posts.postNotFound')
|
||||
message: tpl(messages.postNotFound)
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue