[Glitch] Fix "Create Account" button in interaction modal

Port a664e15702 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
mogaminsk 2023-08-14 19:04:04 +09:00 committed by Claire
parent 7e25e311d5
commit 724d773844
1 changed files with 9 additions and 4 deletions

View File

@ -21,12 +21,16 @@ const messages = defineMessages({
const mapStateToProps = (state, { accountId }) => ({ const mapStateToProps = (state, { accountId }) => ({
displayNameHtml: state.getIn(['accounts', accountId, 'display_name_html']), displayNameHtml: state.getIn(['accounts', accountId, 'display_name_html']),
signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], null) || '/auth/sign_up',
}); });
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
onSignupClick() { onSignupClick() {
dispatch(closeModal()); dispatch(closeModal({
dispatch(openModal('CLOSED_REGISTRATIONS')); modalType: undefined,
ignoreFocus: false,
}));
dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' }));
}, },
}); });
@ -294,6 +298,7 @@ class InteractionModal extends React.PureComponent {
url: PropTypes.string, url: PropTypes.string,
type: PropTypes.oneOf(['reply', 'reblog', 'favourite', 'follow']), type: PropTypes.oneOf(['reply', 'reblog', 'favourite', 'follow']),
onSignupClick: PropTypes.func.isRequired, onSignupClick: PropTypes.func.isRequired,
signupUrl: PropTypes.string.isRequired,
}; };
handleSignupClick = () => { handleSignupClick = () => {
@ -301,7 +306,7 @@ class InteractionModal extends React.PureComponent {
}; };
render () { render () {
const { url, type, displayNameHtml } = this.props; const { url, type, displayNameHtml, signupUrl } = this.props;
const name = <bdi dangerouslySetInnerHTML={{ __html: displayNameHtml }} />; const name = <bdi dangerouslySetInnerHTML={{ __html: displayNameHtml }} />;
@ -340,7 +345,7 @@ class InteractionModal extends React.PureComponent {
); );
} else if (registrationsOpen) { } else if (registrationsOpen) {
signupButton = ( signupButton = (
<a href='/auth/sign_up' className='link-button'> <a href={signupUrl} className='link-button'>
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' /> <FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
</a> </a>
); );