mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
Modify the action for status update.
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
|
||||
export const updateUserStatus = (status, id) => (dispatch, getState) => {
|
||||
console.log('DEBUG ', getState);
|
||||
dispatch({type: 'USER_STATUS_UPDATE', id, status});
|
||||
dispatch({type: 'USER_UPDATE', user: getState().comments.get('byId').get(id)});
|
||||
};
|
||||
|
||||
@@ -46,6 +46,17 @@ class ModerationQueue extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
// Dispatch the appropiate action
|
||||
onAction (status, id) {
|
||||
switch(status){
|
||||
case 'banned':
|
||||
this.props.dispatch(updateUserStatus(status, id));
|
||||
break;
|
||||
default:
|
||||
this.props.dispatch(updateStatus(status, id));
|
||||
}
|
||||
}
|
||||
|
||||
// Dispatch the update comment status action
|
||||
onCommentAction (status, id) {
|
||||
this.props.dispatch(updateStatus(status, id));
|
||||
@@ -87,7 +98,7 @@ class ModerationQueue extends React.Component {
|
||||
.get('status'))
|
||||
}
|
||||
comments={comments.get('byId')}
|
||||
onClickAction={(action, id) => this.onCommentAction(action, id)}
|
||||
onClickAction={(action, id) => this.onAction(action, id)}
|
||||
actions={['reject', 'approve', 'ban']}
|
||||
loading={comments.loading} />
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import {Map, List, fromJS} from 'immutable';
|
||||
import {Map, List} from 'immutable';
|
||||
|
||||
const initialState = Map({
|
||||
byId: Map(),
|
||||
|
||||
Reference in New Issue
Block a user