0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added guards for stripe_plans setting being null

no-issue

There is concern that the settings cache can return `null` for values
which it cannot parse correctly, this just ensures that we always have
an array where we expect one
This commit is contained in:
Fabien O'Carroll 2020-07-07 13:10:10 +02:00
parent 8675a7d317
commit 694d92d270

View file

@ -62,7 +62,7 @@ class MembersConfigProvider {
}; };
try { try {
const plans = this._settingsCache.get('stripe_plans'); const plans = this._settingsCache.get('stripe_plans') || [];
const priceData = plans.reduce((prices, plan) => { const priceData = plans.reduce((prices, plan) => {
const numberAmount = 0 + plan.amount; const numberAmount = 0 + plan.amount;
@ -177,7 +177,7 @@ class MembersConfigProvider {
product: { product: {
name: this._settingsCache.get('stripe_product_name') name: this._settingsCache.get('stripe_product_name')
}, },
plans: [COMPLIMENTARY_PLAN].concat(this._settingsCache.get('stripe_plans')), plans: [COMPLIMENTARY_PLAN].concat(this._settingsCache.get('stripe_plans') || []),
appInfo: { appInfo: {
name: 'Ghost', name: 'Ghost',
partner_id: 'pp_partner_DKmRVtTs4j9pwZ', partner_id: 'pp_partner_DKmRVtTs4j9pwZ',