diff --git a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx index e5b3c17016..67f9cd1711 100644 --- a/app/javascript/flavours/glitch/features/interaction_modal/index.jsx +++ b/app/javascript/flavours/glitch/features/interaction_modal/index.jsx @@ -13,7 +13,7 @@ import { openModal, closeModal } from 'flavours/glitch/actions/modal'; import api from 'flavours/glitch/api'; import Button from 'flavours/glitch/components/button'; import { Icon } from 'flavours/glitch/components/icon'; -import { registrationsOpen } from 'flavours/glitch/initial_state'; +import { registrationsOpen, sso_redirect } from 'flavours/glitch/initial_state'; const messages = defineMessages({ loginPrompt: { id: 'interaction_modal.login.prompt', defaultMessage: 'Domain of your home server, e.g. mastodon.social' }, @@ -331,18 +331,36 @@ class InteractionModal extends React.PureComponent { } let signupButton; + let signUpOrSignInButton; - if (registrationsOpen) { - signupButton = ( - - + if (sso_redirect) { + signUpOrSignInButton = ( + + - ); + ) } else { - signupButton = ( - + if(registrationsOpen) { + signupButton = ( + + + + ); + } else { + signupButton = ( + + ); + } + + signUpOrSignInButton = ( + <> + + + + {signupButton} + ); } @@ -353,6 +371,13 @@ class InteractionModal extends React.PureComponent {

{actionDescription}

+
+
+

+ {signUpOrSignInButton} +
+
+

diff --git a/app/javascript/flavours/glitch/features/ui/components/header.jsx b/app/javascript/flavours/glitch/features/ui/components/header.jsx index 1ebecbd29d..114d348d45 100644 --- a/app/javascript/flavours/glitch/features/ui/components/header.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/header.jsx @@ -13,7 +13,7 @@ import { Avatar } from 'flavours/glitch/components/avatar'; import { Icon } from 'flavours/glitch/components/icon'; import { WordmarkLogo, SymbolLogo } from 'flavours/glitch/components/logo'; import Permalink from 'flavours/glitch/components/permalink'; -import { registrationsOpen, me } from 'flavours/glitch/initial_state'; +import { registrationsOpen, me, sso_redirect } from 'flavours/glitch/initial_state'; const Account = connect(state => ({ account: state.getIn(['accounts', me]), @@ -74,28 +74,35 @@ class Header extends PureComponent { ); } else { - let signupButton; - if (registrationsOpen) { - signupButton = ( - - - - ); + if (sso_redirect) { + content = ( + + ) } else { - signupButton = ( - + let signupButton; + + if (registrationsOpen) { + signupButton = ( + + + + ); + } else { + signupButton = ( + + ); + } + + content = ( + <> + {signupButton} + + ); } - - content = ( - <> - {signupButton} - - - ); } return ( diff --git a/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx b/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx index ea7de7efbb..a8e46df8a1 100644 --- a/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx +++ b/app/javascript/flavours/glitch/features/ui/components/sign_in_banner.jsx @@ -3,7 +3,7 @@ import { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import { openModal } from 'flavours/glitch/actions/modal'; -import { registrationsOpen } from 'flavours/glitch/initial_state'; +import { registrationsOpen, sso_redirect } from 'flavours/glitch/initial_state'; import { useAppDispatch, useAppSelector } from 'flavours/glitch/store'; const SignInBanner = () => { @@ -16,7 +16,16 @@ const SignInBanner = () => { let signupButton; - const signupUrl = useAppSelector((state) => state.getIn(['server', 'server', 'registrations', 'url'], null) || '/auth/sign_up'); + const signupUrl = useAppSelector((state) => state.getIn(['server', 'server', 'registrations', 'url'], null) || '/auth/sign_up'); + + if (sso_redirect) { + return ( +
+

+ +
+ ) + } if (registrationsOpen) { signupButton = ( diff --git a/app/javascript/flavours/glitch/initial_state.js b/app/javascript/flavours/glitch/initial_state.js index f07c9fb71f..46228c3306 100644 --- a/app/javascript/flavours/glitch/initial_state.js +++ b/app/javascript/flavours/glitch/initial_state.js @@ -82,6 +82,7 @@ * @property {boolean} use_blurhash * @property {boolean=} use_pending_items * @property {string} version + * @property {string} sso_redirect * @property {boolean} translation_enabled * @property {string} status_page_url * @property {boolean} system_emoji_font @@ -160,6 +161,7 @@ export const usePendingItems = getMeta('use_pending_items'); export const version = getMeta('version'); export const languages = initialState?.languages; export const statusPageUrl = getMeta('status_page_url'); +export const sso_redirect = getMeta('sso_redirect'); // Glitch-soc-specific settings export const maxChars = (initialState && initialState.max_toot_chars) || 500;