diff --git a/bin/cli-users b/bin/cli-users index 54d7f2927..7f5e56d80 100755 --- a/bin/cli-users +++ b/bin/cli-users @@ -214,6 +214,7 @@ function listUsers() { 'Display Name', 'Profiles', 'Roles', + 'Status', 'State' ] }); @@ -224,6 +225,7 @@ function listUsers() { user.displayName, user.profiles.map((p) => p.provider).join(', '), user.roles.join(', '), + user.status, user.disabled ? 'Disabled' : 'Enabled' ]); }); diff --git a/client/coral-admin/src/components/Comment.js b/client/coral-admin/src/components/Comment.js index bd97bee10..b19be09cd 100644 --- a/client/coral-admin/src/components/Comment.js +++ b/client/coral-admin/src/components/Comment.js @@ -8,7 +8,7 @@ import translations from '../translations.json'; // Render a single comment for the list export default props => ( -
  • +
  • person @@ -19,10 +19,9 @@ export default props => (
    {props.actions.map(action => canShowAction(action, props.comment) ? ( + onClick={() => props.onClickAction(props.actionsMap[action].status, props.comment.get('id'))} colored> + + {props.actionsMap[action].text} ) : null)}
    diff --git a/client/coral-admin/src/components/CommentList.js b/client/coral-admin/src/components/CommentList.js index 3e4ae45cd..e015c54d3 100644 --- a/client/coral-admin/src/components/CommentList.js +++ b/client/coral-admin/src/components/CommentList.js @@ -10,7 +10,7 @@ const actions = { 'reject': {status: 'rejected', icon: 'close', key: 'r'}, 'approve': {status: 'accepted', icon: 'done', key: 't'}, 'flag': {status: 'flagged', icon: 'flag', filter: 'Untouched'}, - 'ban': {status: 'banned'} + 'ban': {status: 'banned', icon: 'not interested', text: 'Ban User'} }; // Renders a comment list and allow performing actions diff --git a/client/coral-admin/src/reducers/users.js b/client/coral-admin/src/reducers/users.js new file mode 100644 index 000000000..68c094816 --- /dev/null +++ b/client/coral-admin/src/reducers/users.js @@ -0,0 +1,23 @@ + +import {Map, List, fromJS} from 'immutable'; + +const initialState = Map({ + byId: Map(), + ids: List(), + loading: false +}); + +// Handle the users actions +export default (state = initialState, action) => { + switch (action.type) { + case 'USER_STATUS_UPDATE': return updateUserStatus(state, action); + default: return state; + } +}; + +// Update a user status +const updateUserStatus = (state, action) => { + const byId = state.get('byId'); + const data = byId.get(action.id).set('status', action.status.toLowerCase()); + return state.set('byId', byId.set(action.id, data)); +};