Put /signup behind feature flags

This commit is contained in:
Alex Gleason 2022-04-30 12:02:30 -05:00
parent 16322e8d6c
commit 706d864293
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 15 additions and 2 deletions

View file

@ -20,7 +20,7 @@ import PublicLayout from 'soapbox/features/public_layout';
import NotificationsContainer from 'soapbox/features/ui/containers/notifications_container'; import NotificationsContainer from 'soapbox/features/ui/containers/notifications_container';
import WaitlistPage from 'soapbox/features/verification/waitlist_page'; import WaitlistPage from 'soapbox/features/verification/waitlist_page';
import { createGlobals } from 'soapbox/globals'; import { createGlobals } from 'soapbox/globals';
import { useAppSelector, useAppDispatch, useOwnAccount, useSoapboxConfig, useSettings } from 'soapbox/hooks'; import { useAppSelector, useAppDispatch, useOwnAccount, useFeatures, useSoapboxConfig, useSettings } from 'soapbox/hooks';
import MESSAGES from 'soapbox/locales/messages'; import MESSAGES from 'soapbox/locales/messages';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features';
import { generateThemeCss } from 'soapbox/utils/theme'; import { generateThemeCss } from 'soapbox/utils/theme';
@ -68,9 +68,11 @@ const SoapboxMount = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const me = useAppSelector(state => state.me); const me = useAppSelector(state => state.me);
const instance = useAppSelector(state => state.instance);
const account = useOwnAccount(); const account = useOwnAccount();
const settings = useSettings(); const settings = useSettings();
const soapboxConfig = useSoapboxConfig(); const soapboxConfig = useSoapboxConfig();
const features = useFeatures();
const locale = validLocale(settings.get('locale')) ? settings.get('locale') : 'en'; const locale = validLocale(settings.get('locale')) ? settings.get('locale') : 'en';
@ -170,7 +172,9 @@ const SoapboxMount = () => {
<Route exact path='/beta/:slug?' component={PublicLayout} /> <Route exact path='/beta/:slug?' component={PublicLayout} />
<Route exact path='/mobile/:slug?' component={PublicLayout} /> <Route exact path='/mobile/:slug?' component={PublicLayout} />
<Route exact path='/login' component={AuthLayout} /> <Route exact path='/login' component={AuthLayout} />
<Route exact path='/signup' component={AuthLayout} /> {(features.accountCreation && instance.registrations) && (
<Route exact path='/signup' component={AuthLayout} />
)}
<Route path='/verify' component={AuthLayout} /> <Route path='/verify' component={AuthLayout} />
<Route path='/reset-password' component={AuthLayout} /> <Route path='/reset-password' component={AuthLayout} />
<Route path='/edit-password' component={AuthLayout} /> <Route path='/edit-password' component={AuthLayout} />

View file

@ -71,6 +71,15 @@ const getInstanceFeatures = (instance: Instance) => {
*/ */
accountByUsername: v.software === PLEROMA, accountByUsername: v.software === PLEROMA,
/**
* Ability to create accounts.
* @see POST /api/v1/accounts
*/
accountCreation: any([
v.software === MASTODON,
v.software === PLEROMA,
]),
/** /**
* Ability to pin other accounts on one's profile. * Ability to pin other accounts on one's profile.
* @see POST /api/v1/accounts/:id/pin * @see POST /api/v1/accounts/:id/pin