0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Updated to handle invite only setting (#139)

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

A new setting `members_signup_access` can be set to `invite` by the site owner which explicitly makes Portal to behave invite only, this change updates Portal to handle the setting
This commit is contained in:
Rishabh Garg 2021-04-27 21:04:58 +05:30 committed by GitHub
parent 3bdfe189d9
commit d690684a56
3 changed files with 7 additions and 2 deletions

View file

@ -5,7 +5,7 @@ import PlansSection from '../common/PlansSection';
import InputForm from '../common/InputForm';
import {ValidateInputForm} from '../../utils/form';
import CalculateDiscount from '../../utils/discount';
import {getSitePlans, hasOnlyFreePlan} from '../../utils/helpers';
import {getSitePlans, hasOnlyFreePlan, isInviteOnlySite} from '../../utils/helpers';
import {ReactComponent as InvitationIcon} from '../../images/icons/invitation.svg';
const React = require('react');
@ -405,7 +405,7 @@ class SignupPage extends React.Component {
const fields = this.getInputFields({state: this.state});
const {site, pageQuery} = this.context;
const availablePlans = getSitePlans({site, pageQuery});
if (availablePlans.length === 0) {
if (availablePlans.length === 0 || isInviteOnlySite({site})) {
return (
<section>
<div className='gh-portal-section'>

View file

@ -11,6 +11,7 @@ export const site = {
currency: 'USD'
},
allow_self_signup: true,
members_signup_access: 'all',
is_stripe_configured: true,
portal_button: true,
portal_name: true,

View file

@ -106,6 +106,10 @@ export function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
export function isInviteOnlySite({site = {}}) {
return site && site.members_signup_access === 'invite';
}
export function getSitePlans({site = {}, includeFree = true, pageQuery} = {}) {
const {
plans,