Updated frontend routing to include products for page/post

refs https://github.com/TryGhost/Team/issues/1071

- `products` relation is needed on post/page to tackle custom tiers visibility, this change attaches `products` as default include for frontend controllers
This commit is contained in:
Rishabh 2022-01-26 16:56:10 +05:30 committed by Rishabh Garg
parent 15d692dc01
commit 93596a1375
5 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ module.exports = function emailPostController(req, res, next) {
const params = { const params = {
uuid: req.params.uuid, uuid: req.params.uuid,
include: 'authors,tags', include: 'authors,tags,tiers',
context: { context: {
member: res.locals.member member: res.locals.member
} }

View File

@ -19,7 +19,7 @@ module.exports = function previewController(req, res, next) {
const params = { const params = {
uuid: req.params.uuid, uuid: req.params.uuid,
status: 'all', status: 'all',
include: 'authors,tags' include: 'authors,tags,tiers'
}; };
return api[res.routerOptions.query.controller] return api[res.routerOptions.query.controller]

View File

@ -13,7 +13,7 @@ function processQuery(query, locals) {
// We override the `include` property for now, because the full data set is required anyway. // We override the `include` property for now, because the full data set is required anyway.
if (_.get(query, 'resource') === 'posts' || _.get(query, 'resource') === 'pages') { if (_.get(query, 'resource') === 'posts' || _.get(query, 'resource') === 'pages') {
_.extend(query.options, { _.extend(query.options, {
include: 'authors,tags' include: 'authors,tags,tiers'
}); });
} }

View File

@ -39,7 +39,7 @@ function entryLookup(postUrl, routerOptions, locals) {
} }
let options = { let options = {
include: 'authors,tags' include: 'authors,tags,tiers'
}; };
options.context = {member: locals.member}; options.context = {member: locals.member};

View File

@ -19,7 +19,7 @@ const queryDefaults = {
*/ */
const defaultQueryOptions = { const defaultQueryOptions = {
options: { options: {
include: 'authors,tags' include: 'authors,tags,tiers'
} }
}; };