From e2813d2cc7a94205b3366f29976e55d95158712d Mon Sep 17 00:00:00 2001 From: gaba Date: Fri, 18 Nov 2016 10:21:03 -0800 Subject: [PATCH] Missing SET_STATUS --- client/coral-admin/src/actions/community.js | 1 - client/coral-admin/src/containers/ModerationQueue.js | 2 +- client/coral-admin/src/reducers/community.js | 10 +++++++++- models/user.js | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/actions/community.js b/client/coral-admin/src/actions/community.js index 057a3bde0..3920b1a5c 100644 --- a/client/coral-admin/src/actions/community.js +++ b/client/coral-admin/src/actions/community.js @@ -14,7 +14,6 @@ import {base, getInit, handleResp} from '../helpers/response'; export const fetchCommenters = (query = {}) => dispatch => { dispatch(requestFetchCommenters()); - console.log('DEBUG ', query); fetch(`${base}/user?${qs.stringify(query)}`, getInit('GET')) .then(handleResp) .then(({result, page, count, limit, totalPages}) => diff --git a/client/coral-admin/src/containers/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue.js index 6a3091639..1b0b7fb4a 100644 --- a/client/coral-admin/src/containers/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue.js @@ -119,7 +119,7 @@ class ModerationQueue extends React.Component { })} comments={comments.get('byId')} onClickAction={(action, id) => this.onCommentAction(action, id)} - actions={['reject', 'approve', 'ban']} + actions={['reject', 'approve']} loading={comments.loading} /> id)); } + case SET_STATUS : { + const commenters = state.get('commenters'); + const idx = commenters.findIndex(el => el.id === action.id); + + commenters[idx].status = action.status; + return state.set('commenters', commenters.map(id => id)); + } case SORT_UPDATE : return state .set('field', action.sort.field) diff --git a/models/user.js b/models/user.js index 0b43ff695..cb56a8e55 100644 --- a/models/user.js +++ b/models/user.js @@ -404,14 +404,14 @@ UserService.removeRoleFromUser = (id, role) => { }; /** - * Adds a role to a user. + * Set status of a user. * @param {String} id id of a user - * @param {String} role role to add + * @param {String} status status to set * @param {Function} done callback after the operation is complete */ UserService.setStatus = (id, status) => { - // Check to see if the user role is in the allowable set of roles. + // Check to see if the user status is in the allowable set of roles. if (USER_STATUS.indexOf(status) === -1) { // User status is not supported! Error out here.