From d8a7edd9aa6f7730deadfac6c677489c91acd5e5 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Wed, 17 Oct 2018 13:24:12 +0200 Subject: [PATCH] Added TODO's for entry and preview controller refs #9866 --- core/server/services/routing/controllers/preview.js | 11 +++++++++++ core/server/services/routing/helpers/post-lookup.js | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/core/server/services/routing/controllers/preview.js b/core/server/services/routing/controllers/preview.js index 51de526fea..3d42af6885 100644 --- a/core/server/services/routing/controllers/preview.js +++ b/core/server/services/routing/controllers/preview.js @@ -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]; diff --git a/core/server/services/routing/helpers/post-lookup.js b/core/server/services/routing/helpers/post-lookup.js index fbf0c1b53a..4233369d01 100644 --- a/core/server/services/routing/helpers/post-lookup.js +++ b/core/server/services/routing/helpers/post-lookup.js @@ -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'}))