0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Filtered active monthly/yearly prices in portal settings

no refs

We only want to show currently active monthly/yearly prices in Portal and Portal settings based on new settings for price ids, and hide all other prices
This commit is contained in:
Rishabh 2021-05-18 20:25:05 +05:30
parent fcef76cebf
commit 11be983d99

View file

@ -26,10 +26,14 @@ export default ModalComponent.extend({
confirm() {}, confirm() {},
filteredPrices: computed('prices', 'settings.portalPlans.[]', function () { filteredPrices: computed('prices', 'settings.{portalPlans.[],membersMonthlyPriceId,membersYearlyPriceId}', function () {
const monthlyPriceId = this.settings.get('membersMonthlyPriceId');
const yearlyPriceId = this.settings.get('membersYearlyPriceId');
const portalPlans = this.settings.get('portalPlans'); const portalPlans = this.settings.get('portalPlans');
const prices = this.prices || []; const prices = this.prices || [];
return prices.filter((d) => { return prices.filter((d) => {
return [monthlyPriceId, yearlyPriceId].includes(d.id);
}).filter((d) => {
return d.amount !== 0 && d.type === 'recurring'; return d.amount !== 0 && d.type === 'recurring';
}).map((price) => { }).map((price) => {
return { return {