mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Serialized missing settings from portal site data
refs https://github.com/TryGhost/Team/issues/1599 - old settings `allow_self_signup` and `is_stripe_configured` and `member_signup_access` are now removed in site data, and are replaced by new settings. - this change maps the new settings to old settings so Portal behavior remains the same - long term, we'll update usages in Portal to rely on new settings only
This commit is contained in:
parent
f7d3d56cb3
commit
7e383a97f6
1 changed files with 28 additions and 0 deletions
|
@ -216,6 +216,34 @@ export function transformApiSiteData({site}) {
|
|||
};
|
||||
});
|
||||
|
||||
site.is_stripe_configured = !!site.paid_members_enabled;
|
||||
site.members_signup_access = 'all';
|
||||
|
||||
if (!site.members_enabled) {
|
||||
site.members_signup_access = 'none';
|
||||
}
|
||||
|
||||
if (site.members_invite_only) {
|
||||
site.members_signup_access = 'invite';
|
||||
}
|
||||
|
||||
site.allow_self_signup = false;
|
||||
|
||||
if (site.members_signup_access !== 'all') {
|
||||
site.allow_self_signup = false;
|
||||
}
|
||||
|
||||
// if stripe is not connected then selected plans mean nothing.
|
||||
// disabling signup would be done by switching to "invite only" mode
|
||||
if (site.paid_members_enabled) {
|
||||
site.allow_self_signup = true;
|
||||
}
|
||||
|
||||
// self signup must be available for free plan signup to work
|
||||
if (site.portal_plans.includes('free')) {
|
||||
site.allow_self_signup = true;
|
||||
}
|
||||
|
||||
// Map tier visibility to old settings
|
||||
if (site.products?.[0]?.visibility) {
|
||||
// Map paid tier visibility to portal products
|
||||
|
|
Loading…
Add table
Reference in a new issue