Added guard for missing portal plans in portal site data

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

Portal died with an unintelligible error about portal plans/includes being undefined when there was another react error on the page. The other error somehow caused the `site` data to be empty object for Portal, and there was one place where we didn't check for the empty object while transforming the site data which caused the failure.

This change adds the guard for failing check so we don't throw the error in such cases and process as normal.
This commit is contained in:
Rishabh 2022-11-18 14:31:35 +05:30
parent dd256f3517
commit 2487a314f5

View File

@ -288,7 +288,7 @@ export function transformApiSiteData({site}) {
}
// self signup must be available for free plan signup to work
if (site.portal_plans.includes('free')) {
if (site.portal_plans?.includes('free')) {
site.allow_self_signup = true;
}