mirror of
https://github.com/wassname/talk.git
synced 2026-07-01 05:42:43 +08:00
Replacing excludeIf
This commit is contained in:
@@ -11,7 +11,7 @@ import {Slot} from 'plugin-api/beta/client/components';
|
||||
|
||||
export default class ModerationActions extends React.Component {
|
||||
render() {
|
||||
const {comment, asset, data, menuVisible, toogleMenu, hideMenu} = this.props;
|
||||
const {comment, root, asset, data, menuVisible, toogleMenu, hideMenu} = this.props;
|
||||
|
||||
return(
|
||||
<ClickOutside onClickOutside={hideMenu}>
|
||||
@@ -30,7 +30,7 @@ export default class ModerationActions extends React.Component {
|
||||
/>
|
||||
<ApproveCommentAction comment={comment} hideMenu={hideMenu} />
|
||||
<RejectCommentAction comment={comment} hideMenu={hideMenu} />
|
||||
<BanUserAction comment={comment} hideMenu={hideMenu} />
|
||||
<BanUserAction comment={comment} root={root} hideMenu={hideMenu} />
|
||||
</Menu>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -14,10 +14,12 @@ class BanUserActionContainer extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
return <BanUserAction
|
||||
onBanUser={this.onBanUser}
|
||||
comment={this.props.comment}
|
||||
/>;
|
||||
const {root: {me}, comment} = this.props;
|
||||
return (me.id !== comment.user.id) ?
|
||||
<BanUserAction
|
||||
onBanUser={this.onBanUser}
|
||||
comment={this.props.comment}
|
||||
/> : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +29,7 @@ const mapDispatchToProps = (dispatch) =>
|
||||
}, dispatch);
|
||||
|
||||
const enhance = compose(
|
||||
connect(null, mapDispatchToProps),
|
||||
excludeIf(({root: {me}, comment}) => !me || me.id === comment.user.id),
|
||||
connect(null, mapDispatchToProps)
|
||||
);
|
||||
|
||||
export default enhance(BanUserActionContainer);
|
||||
|
||||
Reference in New Issue
Block a user