From 9386912b9be989dece035b6978adbc459fb3b177 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 27 Nov 2017 14:43:04 -0300 Subject: [PATCH] Approve Username fix --- .../Community/containers/FlaggedAccounts.js | 13 +++++-------- client/coral-framework/graphql/mutations.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js b/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js index 35b2175bf..310e186e7 100644 --- a/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js +++ b/client/coral-admin/src/routes/Community/containers/FlaggedAccounts.js @@ -6,7 +6,7 @@ import {withFragments} from 'plugin-api/beta/client/hocs'; import {Spinner} from 'coral-ui'; import PropTypes from 'prop-types'; -import {withUnBanUser} from 'coral-framework/graphql/mutations'; +import {withApproveUsername} from 'coral-framework/graphql/mutations'; import {showBanUserDialog} from 'actions/banUserDialog'; import {showSuspendUserDialog} from 'actions/suspendUserDialog'; import {showRejectUsernameDialog} from '../../../actions/community'; @@ -24,11 +24,8 @@ class FlaggedAccountsContainer extends Component { super(props); } - approveUser = ({userId}) => { - return this.props.unBanUser({ - id: userId, - status: false - }); + approveUser = ({userId: id}) => { + return this.props.approveUsername(id); } loadMore = () => { @@ -83,7 +80,7 @@ FlaggedAccountsContainer.propTypes = { showSuspendUserDialog: PropTypes.func, showRejectUsernameDialog: PropTypes.func, viewUserDetail: PropTypes.func, - unBanUser: PropTypes.func, + approveUsername: PropTypes.func, data: PropTypes.object, root: PropTypes.object }; @@ -121,7 +118,7 @@ const mapDispatchToProps = (dispatch) => export default compose( connect(null, mapDispatchToProps), - withUnBanUser, + withApproveUsername, withFragments({ root: gql` fragment TalkAdminCommunity_FlaggedAccounts_root on RootQuery { diff --git a/client/coral-framework/graphql/mutations.js b/client/coral-framework/graphql/mutations.js index 0205f6e21..062c3e7de 100644 --- a/client/coral-framework/graphql/mutations.js +++ b/client/coral-framework/graphql/mutations.js @@ -177,6 +177,25 @@ export const withSuspendUser = withMutation( }) }); +export const withApproveUsername = withMutation( + gql` + mutation ApproveUsername($id: ID!) { + approveUsername(id: $id) { + ...SetUsernameStatusResponse + } + } + `, { + props: ({mutate}) => ({ + approveUsername: (id) => { + return mutate({ + variables: { + id, + }, + }); + } + }) + }); + export const withRejectUsername = withMutation( gql` mutation RejectUsername($id: ID!) {