From 4cc615a5d37ffa561826da91318f10d765f267b6 Mon Sep 17 00:00:00 2001 From: Sag Date: Thu, 30 Nov 2023 11:58:12 -0300 Subject: [PATCH] Updated wording in the support email verification process (#19187) fixes GRO-87 - also updated logic to use the calculated "support_email_address" in Portal settings --- .../settings/membership/portal/AccountPage.tsx | 11 +++++------ .../settings/membership/portal/PortalModal.tsx | 11 ++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx b/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx index b8d5d2ceea..2092aa1dbd 100644 --- a/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/portal/AccountPage.tsx @@ -8,14 +8,13 @@ const AccountPage: React.FC<{ updateSetting: (key: string, setting: SettingValue) => void }> = ({updateSetting}) => { const {siteData, settings, config} = useGlobalData(); - const [membersSupportAddress] = getSettingValues(settings, ['members_support_address']); + const [membersSupportAddress, supportEmailAddress] = getSettingValues(settings, ['members_support_address', 'support_email_address']); + const calculatedSupportAddress = supportEmailAddress?.toString() || fullEmailAddress(membersSupportAddress?.toString() || '', siteData!, config); const emailDomain = getEmailDomain(siteData!, config); - - const [value, setValue] = useState(fullEmailAddress(membersSupportAddress?.toString() || '', siteData!, config)); + const [value, setValue] = useState(calculatedSupportAddress); const updateSupportAddress: FocusEventHandler = (e) => { let supportAddress = e.target.value; - let settingValue = emailDomain && supportAddress === `noreply@${emailDomain}` ? 'noreply' : supportAddress; updateSetting('members_support_address', settingValue); @@ -23,8 +22,8 @@ const AccountPage: React.FC<{ }; useEffect(() => { - setValue(fullEmailAddress(membersSupportAddress?.toString() || '', siteData!, config)); - }, [membersSupportAddress, siteData]); + setValue(calculatedSupportAddress); + }, [calculatedSupportAddress]); return
setValue(e.target.value)} /> diff --git a/apps/admin-x-settings/src/components/settings/membership/portal/PortalModal.tsx b/apps/admin-x-settings/src/components/settings/membership/portal/PortalModal.tsx index 0d2d339825..b8bd440621 100644 --- a/apps/admin-x-settings/src/components/settings/membership/portal/PortalModal.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/portal/PortalModal.tsx @@ -84,8 +84,8 @@ const PortalModal: React.FC = () => { let {settings: verifiedSettings} = await verifyToken({token}); const [supportEmail] = getSettingValues(verifiedSettings, ['members_support_address']); NiceModal.show(ConfirmationModal, { - title: 'Verifying email address', - prompt: <>Success! The support email address has changed to {supportEmail}, + title: 'Support address verified', + prompt: <>Your support email address has been changed to {supportEmail}., okLabel: 'Close', cancelLabel: '', onOk: confirmModal => confirmModal?.remove() @@ -98,7 +98,7 @@ const PortalModal: React.FC = () => { prompt = 'The verification link has expired. Please try again.'; } NiceModal.show(ConfirmationModal, { - title: 'Error verifying email address', + title: 'Error verifying support address', prompt: prompt, okLabel: 'Close', cancelLabel: '', @@ -135,13 +135,14 @@ const PortalModal: React.FC = () => { if (meta?.sent_email_verification) { const newEmail = formState.settings.find(setting => setting.key === 'members_support_address')?.value; - const currentEmail = currentSettings.find(setting => setting.key === 'members_support_address')?.value; + const currentEmail = currentSettings.find(setting => setting.key === 'support_email_address')?.value || + fullEmailAddress(currentSettings.find(setting => setting.key === 'members_support_address')?.value?.toString() || 'noreply', siteData!, config); NiceModal.show(ConfirmationModal, { title: 'Confirm email address', prompt: <> We've sent a confirmation email to {newEmail}. - Until verified, your support address will remain {fullEmailAddress(currentEmail?.toString() || 'noreply', siteData!, config)}. + Until verified, your support email address will remain {currentEmail}. , okLabel: 'Close', cancelLabel: '',