mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-09-22 02:19:59 +03:00
Updated frontend helpers to handle tiers visibility
refs https://github.com/TryGhost/Team/issues/1071 - visibility handling for posts/pages with restricted tiers access has changed, this change updates frontend helpers
This commit is contained in:
parent
b259bb2431
commit
15d692dc01
@ -27,7 +27,7 @@ const buildApiOptions = function buildApiOptions(options, post) {
|
||||
/**
|
||||
* @deprecated: single authors was superceded by multiple authors in Ghost 1.22.0
|
||||
*/
|
||||
include: 'author,authors,tags',
|
||||
include: 'author,authors,tags,tiers',
|
||||
order: 'published_at ' + order,
|
||||
limit: 1,
|
||||
// This line deliberately uses double quotes because GQL cannot handle either double quotes
|
||||
|
@ -6,7 +6,6 @@
|
||||
const {labs} = require('../services/proxy');
|
||||
const {SafeString} = require('../services/rendering');
|
||||
|
||||
const nql = require('@nexes/nql');
|
||||
const isString = require('lodash/isString');
|
||||
|
||||
function products(options = {}) {
|
||||
@ -29,11 +28,8 @@ function products(options = {}) {
|
||||
accessProductsList = productsList;
|
||||
}
|
||||
|
||||
if (this.visibility === 'filter') {
|
||||
const nqlFilter = nql(this.visibility_filter);
|
||||
accessProductsList = productsList.filter((product) => {
|
||||
return nqlFilter.queryJSON({product: product.slug});
|
||||
});
|
||||
if (this.visibility === 'tiers') {
|
||||
accessProductsList = this.tiers;
|
||||
}
|
||||
|
||||
if (accessProductsList.length > 0) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
{{#has visibility="members"}}
|
||||
<h2>This post is for subscribers only</h2>
|
||||
{{/has}}
|
||||
{{#has visibility="filter"}}
|
||||
{{#has visibility="tiers"}}
|
||||
<h2>This post is for subscribers on the {{products}} only </h2>
|
||||
{{/has}}
|
||||
{{#if @member}}
|
||||
|
Loading…
Reference in New Issue
Block a user