mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Added redirect to Email Preferences in Portal after resubscribing (#15940)
closes TryGhost/Team#2360 - Redirect member to Email Preferences after email removed from suppression list.
This commit is contained in:
parent
3817f583fa
commit
5e973688bf
1 changed files with 19 additions and 3 deletions
|
@ -1,22 +1,38 @@
|
|||
import AppContext from 'AppContext';
|
||||
import {useContext, useEffect} from 'react';
|
||||
import {hasCommentsEnabled, hasMultipleNewsletters} from 'utils/helpers';
|
||||
import CloseButton from 'components/common/CloseButton';
|
||||
import BackButton from 'components/common/BackButton';
|
||||
import ActionButton from 'components/common/ActionButton';
|
||||
import {ReactComponent as EmailDeliveryFailedIcon} from 'images/icons/email-delivery-failed.svg';
|
||||
|
||||
export default function EmailSuppressedPage() {
|
||||
const {brandColor, lastPage, onAction, action} = useContext(AppContext);
|
||||
const {brandColor, lastPage, onAction, action, site} = useContext(AppContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (['removeEmailFromSuppressionList:success'].includes(action)) {
|
||||
onAction('refreshMemberData');
|
||||
}
|
||||
|
||||
if (['removeEmailFromSuppressionList:failed', 'refreshMemberData:success', 'refreshMemberData:failed'].includes(action)) {
|
||||
if (['removeEmailFromSuppressionList:failed', 'refreshMemberData:failed'].includes(action)) {
|
||||
onAction('back');
|
||||
}
|
||||
}, [action, onAction]);
|
||||
|
||||
if (['refreshMemberData:success'].includes(action)) {
|
||||
const showEmailPreferences = hasMultipleNewsletters({site}) || hasCommentsEnabled({site});
|
||||
if (showEmailPreferences) {
|
||||
onAction('switchPage', {
|
||||
page: 'accountEmail',
|
||||
lastPage: 'accountHome'
|
||||
});
|
||||
onAction('showPopupNotification', {
|
||||
message: 'You have been successfully resubscribed'
|
||||
});
|
||||
} else {
|
||||
onAction('back');
|
||||
}
|
||||
}
|
||||
}, [action, onAction, site]);
|
||||
|
||||
const isRunning = ['removeEmailFromSuppressionList:running', 'refreshMemberData:running'].includes(action);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue