fix: correctly expose is_active field (#48)
This commit is contained in:
@@ -310,7 +310,7 @@ class AccountSettingsPage extends React.Component {
|
||||
|
||||
<section id="delete-account">
|
||||
<DeleteMyAccount
|
||||
isVerifiedAccount={this.props.is_active}
|
||||
isVerifiedAccount={this.props.isActive}
|
||||
hasLinkedSocial={hasLinkedSocial}
|
||||
/>
|
||||
</section>
|
||||
@@ -408,7 +408,7 @@ AccountSettingsPage.propTypes = {
|
||||
providers: PropTypes.arrayOf(PropTypes.object),
|
||||
staticFields: PropTypes.arrayOf(PropTypes.string),
|
||||
hiddenFields: PropTypes.arrayOf(PropTypes.string),
|
||||
is_active: PropTypes.bool,
|
||||
isActive: PropTypes.bool,
|
||||
|
||||
timeZoneOptions: PropTypes.arrayOf(PropTypes.shape({
|
||||
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
@@ -440,7 +440,7 @@ AccountSettingsPage.defaultProps = {
|
||||
staticFields: [],
|
||||
hiddenFields: ['secondary_email'],
|
||||
duplicateTpaProvider: null,
|
||||
is_active: true,
|
||||
isActive: true,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class DeleteMyAccount extends React.Component {
|
||||
}
|
||||
|
||||
<Modal
|
||||
open={this.props.deletionStatus === 'confirming'}
|
||||
open={this.props.accountDeletionState === 'confirming'}
|
||||
title={intl.formatMessage(messages['account.settings.delete.account.modal.header'])}
|
||||
body={(
|
||||
<div>
|
||||
@@ -199,7 +199,7 @@ class DeleteMyAccount extends React.Component {
|
||||
/>
|
||||
|
||||
<Modal
|
||||
open={this.props.deletionStatus === 'deleted'}
|
||||
open={this.props.accountDeletionState === 'deleted'}
|
||||
title={intl.formatMessage(messages['account.settings.delete.account.modal.after.header'])}
|
||||
body={(
|
||||
<div>
|
||||
@@ -221,7 +221,7 @@ DeleteMyAccount.propTypes = {
|
||||
deleteAccount: PropTypes.func.isRequired,
|
||||
deleteAccountReset: PropTypes.func.isRequired,
|
||||
deleteAccountConfirmation: PropTypes.func.isRequired,
|
||||
deletionStatus: PropTypes.oneOf(['confirming', 'pending', 'deleted', 'failed']),
|
||||
accountDeletionState: PropTypes.oneOf(['confirming', 'pending', 'deleted', 'failed']),
|
||||
deletionError: PropTypes.oneOf(['empty-password', 'server']),
|
||||
hasLinkedSocial: PropTypes.bool,
|
||||
isVerifiedAccount: PropTypes.bool,
|
||||
@@ -231,14 +231,14 @@ DeleteMyAccount.propTypes = {
|
||||
DeleteMyAccount.defaultProps = {
|
||||
hasLinkedSocial: false,
|
||||
isVerifiedAccount: true,
|
||||
deletionStatus: null,
|
||||
accountDeletionState: null,
|
||||
deletionError: null,
|
||||
};
|
||||
|
||||
export default connect(
|
||||
state => ({
|
||||
deletionError: state.accountSettings.deletionError,
|
||||
deletionStatus: state.accountSettings.deletionStatus,
|
||||
accountDeletionState: state.accountSettings.accountDeletionState,
|
||||
}),
|
||||
{
|
||||
deleteAccount,
|
||||
|
||||
@@ -22,7 +22,7 @@ export const defaultState = {
|
||||
confirmationValues: {},
|
||||
drafts: {},
|
||||
saveState: null,
|
||||
deletionStatus: null,
|
||||
accountDeletionState: null,
|
||||
resetPasswordState: null,
|
||||
timeZones: [],
|
||||
countryTimeZones: [],
|
||||
@@ -143,32 +143,32 @@ const accountSettingsReducer = (state = defaultState, action) => {
|
||||
case DELETE_ACCOUNT.CONFIRMATION:
|
||||
return {
|
||||
...state,
|
||||
deletionStatus: 'confirming',
|
||||
accountDeletionState: 'confirming',
|
||||
};
|
||||
|
||||
case DELETE_ACCOUNT.BEGIN:
|
||||
return {
|
||||
...state,
|
||||
deletionStatus: 'pending',
|
||||
accountDeletionState: 'pending',
|
||||
};
|
||||
|
||||
case DELETE_ACCOUNT.SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
deletionStatus: 'deleted',
|
||||
accountDeletionState: 'deleted',
|
||||
};
|
||||
|
||||
case DELETE_ACCOUNT.FAILURE:
|
||||
return {
|
||||
...state,
|
||||
deletionStatus: 'failed',
|
||||
accountDeletionState: 'failed',
|
||||
deletionError: 'server',
|
||||
};
|
||||
|
||||
case DELETE_ACCOUNT.RESET:
|
||||
return {
|
||||
...state,
|
||||
deletionStatus: null,
|
||||
accountDeletionState: null,
|
||||
deletionError: null,
|
||||
};
|
||||
|
||||
|
||||
@@ -141,6 +141,10 @@ const countryTimeZonesSelector = createSelector(
|
||||
accountSettings => transformTimeZonesToOptions(accountSettings.countryTimeZones),
|
||||
);
|
||||
|
||||
const verifiedAccountSelector = createSelector(
|
||||
accountSettingsSelector,
|
||||
accountSettings => accountSettings.values.is_active,
|
||||
);
|
||||
|
||||
/**
|
||||
* This selector converts the site language code back to the server version so that it can match up
|
||||
@@ -186,6 +190,7 @@ export const accountSettingsPageSelector = createSelector(
|
||||
hiddenFieldsSelector,
|
||||
timeZonesSelector,
|
||||
countryTimeZonesSelector,
|
||||
verifiedAccountSelector,
|
||||
duplicateTpaProviderSelector,
|
||||
(
|
||||
accountSettings,
|
||||
@@ -199,6 +204,7 @@ export const accountSettingsPageSelector = createSelector(
|
||||
hiddenFields,
|
||||
timeZoneOptions,
|
||||
countryTimeZoneOptions,
|
||||
isActive,
|
||||
duplicateTpaProvider,
|
||||
) => ({
|
||||
siteLanguageOptions,
|
||||
@@ -210,6 +216,7 @@ export const accountSettingsPageSelector = createSelector(
|
||||
loadingError: accountSettings.loadingError,
|
||||
timeZoneOptions,
|
||||
countryTimeZoneOptions,
|
||||
isActive,
|
||||
formValues,
|
||||
profileDataManager,
|
||||
staticFields,
|
||||
|
||||
Reference in New Issue
Block a user