mirror of
https://github.com/wassname/talk.git
synced 2026-07-20 12:40:47 +08:00
Missing SET_STATUS
This commit is contained in:
@@ -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}) =>
|
||||
|
||||
@@ -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} />
|
||||
</div>
|
||||
<ModerationKeysModal open={modalOpen}
|
||||
|
||||
@@ -5,7 +5,8 @@ import {
|
||||
FETCH_COMMENTERS_FAILURE,
|
||||
FETCH_COMMENTERS_SUCCESS,
|
||||
SORT_UPDATE,
|
||||
SET_ROLE
|
||||
SET_ROLE,
|
||||
SET_STATUS
|
||||
} from '../constants/community';
|
||||
|
||||
const initialState = Map({
|
||||
@@ -45,6 +46,13 @@ export default function community (state = initialState, action) {
|
||||
commenters[idx].roles[0] = action.role;
|
||||
return state.set('commenters', commenters.map(id => 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)
|
||||
|
||||
+3
-3
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user