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
|
* @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,
|
order: 'published_at ' + order,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
// This line deliberately uses double quotes because GQL cannot handle either double quotes
|
// This line deliberately uses double quotes because GQL cannot handle either double quotes
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
const {labs} = require('../services/proxy');
|
const {labs} = require('../services/proxy');
|
||||||
const {SafeString} = require('../services/rendering');
|
const {SafeString} = require('../services/rendering');
|
||||||
|
|
||||||
const nql = require('@nexes/nql');
|
|
||||||
const isString = require('lodash/isString');
|
const isString = require('lodash/isString');
|
||||||
|
|
||||||
function products(options = {}) {
|
function products(options = {}) {
|
||||||
@ -29,11 +28,8 @@ function products(options = {}) {
|
|||||||
accessProductsList = productsList;
|
accessProductsList = productsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.visibility === 'filter') {
|
if (this.visibility === 'tiers') {
|
||||||
const nqlFilter = nql(this.visibility_filter);
|
accessProductsList = this.tiers;
|
||||||
accessProductsList = productsList.filter((product) => {
|
|
||||||
return nqlFilter.queryJSON({product: product.slug});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accessProductsList.length > 0) {
|
if (accessProductsList.length > 0) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
{{#has visibility="members"}}
|
{{#has visibility="members"}}
|
||||||
<h2>This post is for subscribers only</h2>
|
<h2>This post is for subscribers only</h2>
|
||||||
{{/has}}
|
{{/has}}
|
||||||
{{#has visibility="filter"}}
|
{{#has visibility="tiers"}}
|
||||||
<h2>This post is for subscribers on the {{products}} only </h2>
|
<h2>This post is for subscribers on the {{products}} only </h2>
|
||||||
{{/has}}
|
{{/has}}
|
||||||
{{#if @member}}
|
{{#if @member}}
|
||||||
|
Loading…
Reference in New Issue
Block a user