mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
parent
cbf2817e39
commit
d8a7edd9aa
2 changed files with 19 additions and 0 deletions
|
@ -14,6 +14,17 @@ module.exports = function previewController(req, res, next) {
|
|||
include: 'author,authors,tags'
|
||||
};
|
||||
|
||||
/**
|
||||
* @TODO:
|
||||
*
|
||||
* We actually need to differentiate here between pages and posts controller for v2.
|
||||
* Currently this API call is without context object and it works out of the box, because the v2 serializer
|
||||
* only forces `page:true|false` if you send a content key.
|
||||
*
|
||||
* It's also a little tricky, because the v0.1 has no pages controller.
|
||||
* Furthermore, the preview router is used for pages and posts and we just receive a uuid. How to know
|
||||
* which controller to call? pages or posts?
|
||||
*/
|
||||
api.posts.read(params)
|
||||
.then(function then(result) {
|
||||
const post = result.posts[0];
|
||||
|
|
|
@ -33,6 +33,14 @@ function postLookup(postUrl, routerOptions, locals) {
|
|||
/**
|
||||
* Query database to find post.
|
||||
*
|
||||
* @TODO:
|
||||
*
|
||||
* We actually need to differentiate here between pages and posts controller for v2.
|
||||
* Currently this API call is without context object and it works out of the box, because the v2 serializer
|
||||
* only forces `page:true|false` if you send a content key.
|
||||
*
|
||||
* It's also a little tricky, because the v0.1 has no pages controller.
|
||||
*
|
||||
* @deprecated: `author`, will be removed in Ghost 3.0
|
||||
*/
|
||||
return api.posts.read(_.extend(_.pick(params, 'slug', 'id'), {include: 'author,authors,tags'}))
|
||||
|
|
Loading…
Reference in a new issue