mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 14:09:31 +08:00
Don't ignore myself
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import React from 'react';
|
||||
import IgnoreUserAction from '../components/IgnoreUserAction';
|
||||
import {compose} from 'react-apollo';
|
||||
import {connect, withFragments} from 'plugin-api/beta/client/hocs';
|
||||
import {compose, gql} from 'react-apollo';
|
||||
import {connect, withFragments, excludeIf} from 'plugin-api/beta/client/hocs';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {setContentSlot} from 'plugins/talk-plugin-author-menu/client/actions';
|
||||
import IgnoreUserConfirmation from './IgnoreUserConfirmation';
|
||||
import {getDefinitionName} from 'plugin-api/beta/client/utils';
|
||||
|
||||
class IgnoreUserActionContainer extends React.Component {
|
||||
|
||||
@@ -24,11 +25,29 @@ const mapDispatchToProps = (dispatch) =>
|
||||
setContentSlot,
|
||||
}, dispatch);
|
||||
|
||||
const withIgnoreUserActionFragments = withFragments(IgnoreUserConfirmation.fragments);
|
||||
const withIgnoreUserActionFragments = withFragments({
|
||||
root: gql`
|
||||
fragment TalkIgnoreUser_IgnoreUserAction_root on RootQuery {
|
||||
me {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
comment: gql`
|
||||
fragment TalkIgnoreUser_IgnoreUserAction_comment on Comment {
|
||||
user {
|
||||
id
|
||||
}
|
||||
...${getDefinitionName(IgnoreUserConfirmation.fragments.comment)}
|
||||
}
|
||||
${IgnoreUserConfirmation.fragments.comment}
|
||||
`,
|
||||
});
|
||||
|
||||
const enhance = compose(
|
||||
connect(null, mapDispatchToProps),
|
||||
withIgnoreUserActionFragments,
|
||||
excludeIf(({root: {me}, comment}) => me.id === comment.user.id),
|
||||
);
|
||||
|
||||
export default enhance(IgnoreUserActionContainer);
|
||||
|
||||
Reference in New Issue
Block a user