Merge branch 'fix-onboarding-modal' into 'main'

Make the onboarding modal show up again (during Nostr login flow)

See merge request soapbox-pub/soapbox!3317
This commit is contained in:
Alex Gleason 2025-01-28 18:02:48 +00:00
commit e46211bdc7
3 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { fetchMe } from 'soapbox/actions/me.ts';
import { closeModal } from 'soapbox/actions/modals.ts';
import { HTTPError } from 'soapbox/api/HTTPError.ts';
import { useApi } from 'soapbox/hooks/useApi.ts';
@ -9,8 +10,6 @@ import { useInstance } from 'soapbox/hooks/useInstance.ts';
import { captchaSchema, type CaptchaData } from 'soapbox/schemas/captcha.ts';
import toast from 'soapbox/toast.tsx';
const messages = defineMessages({
sucessMessage: { id: 'nostr_signup.captcha_message.sucess', defaultMessage: 'Incredible! You\'ve successfully completed the captcha.' },
wrongMessage: { id: 'nostr_signup.captcha_message.wrong', defaultMessage: 'Oops! It looks like your captcha response was incorrect. Please try again.' },
@ -66,12 +65,10 @@ const useCaptcha = () => {
};
try {
await api.post(`/api/v1/ditto/captcha/${captcha.id}/verify`, result).then(() => {
setTryAgain(true);
await api.post(`/api/v1/ditto/captcha/${captcha.id}/verify`, result);
dispatch(closeModal('CAPTCHA'));
await dispatch(fetchMe()); // refetch account so `captcha_solved` changes.
toast.success(messages.sucessMessage);
});
} catch (error) {
setTryAgain(true);

View File

@ -6,6 +6,7 @@ import { FormattedMessage } from 'react-intl';
import { fetchAccount } from 'soapbox/actions/accounts.ts';
import { logInNostr } from 'soapbox/actions/nostr.ts';
import { startOnboarding } from 'soapbox/actions/onboarding.ts';
import { closeSidebar } from 'soapbox/actions/sidebar.ts';
import EmojiGraphic from 'soapbox/components/emoji-graphic.tsx';
import Button from 'soapbox/components/ui/button.tsx';
@ -79,6 +80,7 @@ const KeygenStep: React.FC<IKeygenStep> = ({ onClose }) => {
dispatch(closeSidebar());
}
dispatch(startOnboarding());
};
return (

View File

@ -39,9 +39,11 @@ const SoapboxMount = () => {
}
}, [showCaptcha]);
if (showOnboarding) {
useEffect(() => {
if (showOnboarding && !showCaptcha) {
dispatch(openModal('ONBOARDING_FLOW'));
}
}, [showOnboarding, showCaptcha]);
const { redirectRootNoLogin, gdpr } = soapboxConfig;