From 706d864293e113326013c8925405ddc54ecc380f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 30 Apr 2022 12:02:30 -0500 Subject: [PATCH] Put /signup behind feature flags --- app/soapbox/containers/soapbox.tsx | 8 ++++++-- app/soapbox/utils/features.ts | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/soapbox/containers/soapbox.tsx b/app/soapbox/containers/soapbox.tsx index 7bae3a2165..0b27ee33ee 100644 --- a/app/soapbox/containers/soapbox.tsx +++ b/app/soapbox/containers/soapbox.tsx @@ -20,7 +20,7 @@ import PublicLayout from 'soapbox/features/public_layout'; import NotificationsContainer from 'soapbox/features/ui/containers/notifications_container'; import WaitlistPage from 'soapbox/features/verification/waitlist_page'; 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 { getFeatures } from 'soapbox/utils/features'; import { generateThemeCss } from 'soapbox/utils/theme'; @@ -68,9 +68,11 @@ const SoapboxMount = () => { const dispatch = useAppDispatch(); const me = useAppSelector(state => state.me); + const instance = useAppSelector(state => state.instance); const account = useOwnAccount(); const settings = useSettings(); const soapboxConfig = useSoapboxConfig(); + const features = useFeatures(); const locale = validLocale(settings.get('locale')) ? settings.get('locale') : 'en'; @@ -170,7 +172,9 @@ const SoapboxMount = () => { - + {(features.accountCreation && instance.registrations) && ( + + )} diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index d4b4d1e32a..4591eb8805 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -71,6 +71,15 @@ const getInstanceFeatures = (instance: Instance) => { */ 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. * @see POST /api/v1/accounts/:id/pin