Registrations aren't really open unless accountCreation is supported
This commit is contained in:
parent
7fecd521d7
commit
3785a2890f
|
@ -3,11 +3,12 @@ import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import VerificationBadge from 'soapbox/components/verification_badge';
|
import VerificationBadge from 'soapbox/components/verification_badge';
|
||||||
import RegistrationForm from 'soapbox/features/auth_login/components/registration_form';
|
import RegistrationForm from 'soapbox/features/auth_login/components/registration_form';
|
||||||
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
|
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
|
|
||||||
import { Button, Card, CardBody, Stack, Text } from '../../components/ui';
|
import { Button, Card, CardBody, Stack, Text } from '../../components/ui';
|
||||||
|
|
||||||
const LandingPage = () => {
|
const LandingPage = () => {
|
||||||
|
const features = useFeatures();
|
||||||
const soapboxConfig = useSoapboxConfig();
|
const soapboxConfig = useSoapboxConfig();
|
||||||
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
|
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ const LandingPage = () => {
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='registration.closed_message'
|
id='registration.closed_message'
|
||||||
defaultMessage='{instance} is not accepting new members.'
|
defaultMessage='{instance} is not accepting new members.'
|
||||||
values={{ instance: instance.get('title') }}
|
values={{ instance: instance.title }}
|
||||||
/>
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@ -60,7 +61,7 @@ const LandingPage = () => {
|
||||||
const renderBody = () => {
|
const renderBody = () => {
|
||||||
if (pepeEnabled && pepeOpen) {
|
if (pepeEnabled && pepeOpen) {
|
||||||
return renderPepe();
|
return renderPepe();
|
||||||
} else if (instance.registrations) {
|
} else if (features.accountCreation && instance.registrations) {
|
||||||
return renderOpen();
|
return renderOpen();
|
||||||
} else {
|
} else {
|
||||||
return renderClosed();
|
return renderClosed();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Link, Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
|
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
|
||||||
import { fetchInstance } from 'soapbox/actions/instance';
|
import { fetchInstance } from 'soapbox/actions/instance';
|
||||||
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
|
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
|
|
||||||
import { openModal } from '../../../actions/modals';
|
import { openModal } from '../../../actions/modals';
|
||||||
import { Button, Form, HStack, IconButton, Input, Tooltip } from '../../../components/ui';
|
import { Button, Form, HStack, IconButton, Input, Tooltip } from '../../../components/ui';
|
||||||
|
@ -31,8 +31,9 @@ const Header = () => {
|
||||||
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
|
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
|
||||||
|
|
||||||
const { logo } = soapboxConfig;
|
const { logo } = soapboxConfig;
|
||||||
|
const features = useFeatures();
|
||||||
const instance = useAppSelector((state) => state.instance);
|
const instance = useAppSelector((state) => state.instance);
|
||||||
const isOpen = instance.get('registrations', false) === true;
|
const isOpen = features.accountCreation && instance.registrations;
|
||||||
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
|
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
|
||||||
|
|
||||||
const [isLoading, setLoading] = React.useState(false);
|
const [isLoading, setLoading] = React.useState(false);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { Button } from 'soapbox/components/ui';
|
import { Button } from 'soapbox/components/ui';
|
||||||
import { Modal } from 'soapbox/components/ui';
|
import { Modal } from 'soapbox/components/ui';
|
||||||
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
|
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
download: { id: 'landing_page_modal.download', defaultMessage: 'Download' },
|
download: { id: 'landing_page_modal.download', defaultMessage: 'Download' },
|
||||||
|
@ -25,8 +25,9 @@ const LandingPageModal: React.FC<ILandingPageModal> = ({ onClose }) => {
|
||||||
|
|
||||||
const { logo } = soapboxConfig;
|
const { logo } = soapboxConfig;
|
||||||
const instance = useAppSelector((state) => state.instance);
|
const instance = useAppSelector((state) => state.instance);
|
||||||
|
const features = useFeatures();
|
||||||
|
|
||||||
const isOpen = instance.get('registrations', false) === true;
|
const isOpen = features.accountCreation && instance.registrations;
|
||||||
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
|
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue