Fix suspend button.

This commit is contained in:
gaba
2017-03-02 16:43:52 -08:00
parent 2fa832a3f4
commit 0fe456f574
4 changed files with 13 additions and 15 deletions
@@ -94,7 +94,6 @@ class CommunityContainer extends Component {
);
}
console.log('debug props', props);
return (
<div>
<FlaggedAccounts
@@ -103,6 +102,7 @@ class CommunityContainer extends Component {
error={data.error}
showBanUserDialog={props.showBanUserDialog}
approveUser={props.approveUser}
suspendUser={props.suspendUser}
showSuspendUserDialog={props.showSuspendUserDialog}
{...this}
/>
@@ -112,9 +112,9 @@ class CommunityContainer extends Component {
handleClose={props.hideBanUserDialog}
handleBanUser={props.banUser}
/>
<SuspendUserDialog
<SuspendUserDialog
open={community.suspendDialog}
onClose={props.hideSuspendUserDialog}
handleClose={props.hideSuspendUserDialog}
user={community.user}
suspendUser={props.suspendUser}
/>
@@ -146,7 +146,7 @@ const mapDispatchToProps = dispatch => ({
fetchAccounts: query => dispatch(fetchAccounts(query)),
showBanUserDialog: (user) => dispatch(showBanUserDialog(user)),
hideBanUserDialog: () => dispatch(hideBanUserDialog(false)),
showSuspendUserDialog: () => dispatch(showSuspendUserDialog()),
showSuspendUserDialog: (user) => dispatch(showSuspendUserDialog(user)),
hideSuspendUserDialog: () => dispatch(hideSuspendUserDialog())
});
@@ -29,6 +29,7 @@ const FlaggedAccounts = ({...props}) => {
showBanUserDialog={props.showBanUserDialog}
showSuspendUserDialog={props.showSuspendUserDialog}
approveUser={props.approveUser}
suspendUser={props.suspendUser}
/>;
})
: <EmptyCard>{lang.t('community.no-flagged-accounts')}</EmptyCard>
@@ -33,7 +33,7 @@ class SuspendUserDialog extends Component {
static propTypes = {
stage: PropTypes.number,
onClose: PropTypes.func.isRequired,
handleClose: PropTypes.func.isRequired,
suspendUser: PropTypes.func.isRequired
}
@@ -47,17 +47,14 @@ class SuspendUserDialog extends Component {
*/
onActionClick = (stage, menuOption) => () => {
const {suspendUser, user} = this.props;
const {stage, email} = this.state;
console.log('DEBUG props --> ', this.props);
console.log('DEBUG user', user);
const {stage} = this.state;
const cancel = this.props.onClose;
const next = () => this.setState({stage: stage + 1});
const suspend = () => {
suspendUser({userId: user.id, email})
suspendUser({userId: user.user.id})
.then(() => {
this.props.onClose;
this.props.handleClose();
});
};
@@ -69,20 +66,19 @@ class SuspendUserDialog extends Component {
}
onEmailChange = (e) => {
console.log('debug emailchange', e.target);
this.setState({email: e.target.value});
}
render () {
const {open, onClose} = this.props;
const {open, handleClose} = this.props;
const {stage} = this.state;
return <Dialog
className={styles.suspendDialog}
id="suspendUserDialog"
open={open}
onClose={onClose}
onCancel={onClose}
onClose={handleClose}
onCancel={handleClose}
title={lang.t('suspenduser.title')}>
<div className={styles.title}>
{lang.t(stages[stage].title, lang.t('suspenduser.username'))}
@@ -56,6 +56,7 @@ const User = props => {
key={i}
user={user}
approveUser={props.approveUser}
suspendUser={props.suspendUser}
showSuspendUserDialog={props.showSuspendUserDialog}
/>;
}