diff --git a/client/coral-admin/src/graphql/index.js b/client/coral-admin/src/graphql/index.js index d5ada0557..8e701b707 100644 --- a/client/coral-admin/src/graphql/index.js +++ b/client/coral-admin/src/graphql/index.js @@ -3,6 +3,28 @@ import {mapLeaves} from 'coral-framework/utils'; export default { mutations: { + SetUserRole: ({variables: {id: userId, role}}) => ({ + updateQueries: { + TalkAdmin_Community: (prev) => { + + const updated = update(prev, { + users: { + nodes: { + $apply: (nodes) => nodes.map((node) => { + if (node.id === userId) { + node.role = role; + } + + return node; + }) + }, + }, + }); + + return updated; + } + } + }), BanUser: ({variables: {input: {id: userId}}}) => ({ updateQueries: { TalkAdmin_Community: (prev) => { diff --git a/client/coral-admin/src/routes/Community/containers/People.js b/client/coral-admin/src/routes/Community/containers/People.js index f6f84ec69..e262bf28a 100644 --- a/client/coral-admin/src/routes/Community/containers/People.js +++ b/client/coral-admin/src/routes/Community/containers/People.js @@ -36,7 +36,6 @@ class PeopleContainer extends React.Component { setUserRole = async (id, role) => { await this.props.setUserRole(id, role); - await this.fetchUsers(); } loadMore = () => {