mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
parent
10a24393d0
commit
1d534bcd65
1 changed files with 7 additions and 3 deletions
|
@ -1,10 +1,14 @@
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
const i18n = require('../../../shared/i18n');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const getPostServiceInstance = require('../../services/posts/posts-service');
|
const getPostServiceInstance = require('../../services/posts/posts-service');
|
||||||
const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles'];
|
const ALLOWED_INCLUDES = ['tags', 'authors', 'authors.roles'];
|
||||||
const UNSAFE_ATTRS = ['status', 'authors', 'visibility'];
|
const UNSAFE_ATTRS = ['status', 'authors', 'visibility'];
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
pageNotFound: 'Page not found.'
|
||||||
|
};
|
||||||
|
|
||||||
const postsService = getPostServiceInstance('canary');
|
const postsService = getPostServiceInstance('canary');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -75,7 +79,7 @@ module.exports = {
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
throw new errors.NotFoundError({
|
throw new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.pages.pageNotFound')
|
message: tpl(messages.pageNotFound)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +192,7 @@ module.exports = {
|
||||||
.then(() => null)
|
.then(() => null)
|
||||||
.catch(models.Post.NotFoundError, () => {
|
.catch(models.Post.NotFoundError, () => {
|
||||||
return Promise.reject(new errors.NotFoundError({
|
return Promise.reject(new errors.NotFoundError({
|
||||||
message: i18n.t('errors.api.pages.pageNotFound')
|
message: tpl(messages.pageNotFound)
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue