mirror of
https://github.com/wassname/talk.git
synced 2026-07-29 11:28:24 +08:00
Add ban action.
This commit is contained in:
@@ -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'
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import translations from '../translations.json';
|
||||
|
||||
// Render a single comment for the list
|
||||
export default props => (
|
||||
<li tabindex={props.index} className={`${styles.listItem} ${props.isActive && !props.hideActive ? styles.activeItem : ''}`}>
|
||||
<li tabIndex={props.index} className={`${styles.listItem} ${props.isActive && !props.hideActive ? styles.activeItem : ''}`}>
|
||||
<div className={styles.itemHeader}>
|
||||
<div className={styles.author}>
|
||||
<i className={`material-icons ${styles.avatar}`}>person</i>
|
||||
@@ -19,10 +19,9 @@ export default props => (
|
||||
<div className={styles.actions}>
|
||||
{props.actions.map(action => canShowAction(action, props.comment) ? (
|
||||
<Button className={styles.actionButton}
|
||||
onClick={() => props.onClickAction(props.actionsMap[action].status, props.comment.get('id'))}
|
||||
fab colored>
|
||||
<Icon name={props.actionsMap[action].icon} />
|
||||
<Button>{props.actionsMap[action]}</Button>
|
||||
onClick={() => props.onClickAction(props.actionsMap[action].status, props.comment.get('id'))} colored>
|
||||
<Icon name={props.actionsMap[action].icon}/>
|
||||
{props.actionsMap[action].text}
|
||||
</Button>
|
||||
) : null)}
|
||||
</div>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
};
|
||||
Reference in New Issue
Block a user