Reverts the work on ban in the coral-admin getting everything from master for it.

This commit is contained in:
gaba
2016-11-29 11:35:55 -08:00
parent 281d4f6552
commit a5f67e10d6
12 changed files with 18 additions and 108 deletions
+2 -11
View File
@@ -1,3 +1,4 @@
import React from 'react';
import timeago from 'timeago.js';
import styles from './CommentList.css';
@@ -20,7 +21,6 @@ export default props => {
<i className={`material-icons ${styles.avatar}`}>person</i>
<span>{props.comment.get('name') || lang.t('comment.anon')}</span>
<span className={styles.created}>{timeago().format(props.comment.get('createdAt') || (Date.now() - props.index * 60 * 1000), lang.getLocale().replace('-', '_'))}</span>
{props.comment.get('banned') ? <p className={styles.banned}>{lang.t('comment.banned-user')}</p> : null}
{props.comment.get('flagged') ? <p className={styles.flagged}>{lang.t('comment.flagged')}</p> : null}
</div>
<div>
@@ -32,9 +32,7 @@ export default props => {
cStyle={action}
key={i}
onClick={() => props.onClickAction(props.actionsMap[action].status, props.comment.get('id'))}
fab colored>
<Icon name={props.actionsMap[action].icon} />
</FabButton>
/>
) : null)}
</div>
</div>
@@ -54,14 +52,7 @@ export default props => {
const canShowAction = (action, comment) => {
const status = comment.get('status');
const flagged = comment.get('flagged');
//const banned = comment.get('banned');
// // If the user that authored the comment is banned then do not ban it again.
// if (action === 'ban' && !banned) {
// return false;
// }
// If it is flagged do not flag it .
if (action === 'flag' && (status || flagged === true)) {
return false;
}
@@ -97,12 +97,6 @@
padding-top: 15px;
padding-left: 10px;
}
.banned {
color: rgba(255, 0, 0, .5);
padding-top: 15px;
padding-left: 10px;
}
}
.empty {
@@ -9,8 +9,7 @@ import Comment from 'components/Comment';
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', icon: 'not interested', text: 'Ban User'}
'flag': {status: 'flagged', icon: 'flag', filter: 'Untouched'}
};
// Renders a comment list and allow performing actions
@@ -40,7 +39,7 @@ export default class CommentList extends React.Component {
}
}
// Add swipe to approve or reject or ban
// Add swipe to approve or reject
bindGestures () {
const {actions} = this.props;
this._hammer = new Hammer(this.base);
@@ -52,9 +51,6 @@ export default class CommentList extends React.Component {
if (actions.indexOf('approve') !== -1) {
this._hammer.on('swiperight', () => this.props.singleView && this.actionKeyHandler('Approved'));
}
if (actions.indexOf('ban') !== -1) {
this._hammer.on('swipeup', () => this.props.singleView && this.actionKeyHandler('Banned'));
}
}
// Add key handlers. Each action has one and added j/k for moving around
@@ -4,4 +4,3 @@ export const FETCH_COMMENTERS_FAILURE = 'FETCH_COMMENTERS_FAILURE';
export const SORT_UPDATE = 'SORT_UPDATE';
export const COMMENTERS_NEW_PAGE = 'COMMENTERS_NEW_PAGE';
export const SET_ROLE = 'SET_ROLE';
export const SET_STATUS = 'SET_STATUS';
@@ -15,13 +15,8 @@
.searchBox {
/*border: 1px solid rgba(0,0,0,.12);*/
background: white;
width: 100px;
}
.statusBox {
width: 100px;
}
.email {
display: block;
}
}
@@ -20,10 +20,6 @@ const tableHeaders = [
title: lang.t('community.account_creation_date'),
field: 'created_at'
},
{
title: lang.t('community.status'),
field: 'status'
},
{
title: lang.t('community.newsroom_role'),
field: 'role'
@@ -34,7 +30,7 @@ const Community = ({isFetching, commenters, ...props}) => {
const hasResults = !isFetching && !!commenters.length;
return (
<Grid>
<Cell col={3}>
<Cell col={4}>
<form action="">
<div className={`mdl-textfield ${styles.searchBox}`}>
<label className="mdl-button mdl-js-button mdl-button--icon" htmlFor="commenters-search">
@@ -1,12 +1,7 @@
import React from 'react';
import I18n from 'coral-framework/modules/i18n/i18n';
import translations from '../../translations.json';
const Loading = () => (
<h1> {lang.t('community.loading')} </h1>
<h1> Loading results </h1>
);
export default Loading;
const lang = new I18n(translations);
@@ -1,14 +1,9 @@
import React from 'react';
import I18n from 'coral-framework/modules/i18n/i18n';
import translations from '../../translations.json';
const NoResults = () => (
<div>
{lang.t('community.no-results')}
No users found with that user name or email address
</div>
);
export default NoResults;
const lang = new I18n(translations);
@@ -4,7 +4,7 @@ import {SelectField, Option} from 'react-mdl-selectfield';
import styles from './Community.css';
import I18n from 'coral-framework/modules/i18n/i18n';
import translations from '../../translations';
import {setRole, setStatus} from '../../actions/community';
import {setRole} from '../../actions/community';
const lang = new I18n(translations);
@@ -13,17 +13,12 @@ class Table extends Component {
constructor (props) {
super(props);
this.onRoleChange = this.onRoleChange.bind(this);
this.onStatusChange = this.onStatusChange.bind(this);
}
onRoleChange (id, role) {
this.props.dispatch(setRole(id, role));
}
onStatusChange (id, status) {
this.props.dispatch(setStatus(id, status));
}
render () {
const {headers, commenters, onHeaderClickHandler} = this.props;
@@ -51,14 +46,6 @@ class Table extends Component {
<td className="mdl-data-table__cell--non-numeric">
{row.created_at}
</td>
<td className={`mdl-data-table__cell--non-numeric ${styles.statusBox}`}>
<SelectField label={'Select me'} value={row.status}
label={lang.t('community.select-status')}
onChange={status => this.onStatusChange(row.id, status)}>
<Option value={'active'}>{lang.t('community.active')}</Option>
<Option value={'banned'}>{lang.t('community.banned')}</Option>
</SelectField>
</td>
<td className="mdl-data-table__cell--non-numeric">
<SelectField label={'Select me'} value={row.roles[0] || ''}
label={lang.t('community.role')}
@@ -6,15 +6,15 @@ import ModerationKeysModal from 'components/ModerationKeysModal';
import CommentList from 'components/CommentList';
import {updateStatus} from 'actions/comments';
import {updateUserStatus} from 'actions/users';
import styles from './ModerationQueue.css';
import I18n from 'coral-framework/modules/i18n/i18n';
import translations from '../../translations.json';
/*
* Renders the moderation queue as a tabbed layout with 3 moderation queues
* * pending: filtered by status Untouchedand comments that are flagged in the post-moderation setting.
* Renders the moderation queue as a tabbed layout with 3 moderation
* queues :
* * pending: filtered by status Untouched
* * rejected: filtered by status Rejected
* * flagged: with a flagged action on them
*/
@@ -50,27 +50,11 @@ 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
// Dispatch the update status action
onCommentAction (status, id) {
this.props.dispatch(updateStatus(status, id));
}
// Dispatch the update user status action
onUserAction (status, id) {
this.props.dispatch(updateUserStatus(status, id));
}
onTabClick (activeTab) {
this.setState({activeTab});
}
@@ -102,8 +86,8 @@ class ModerationQueue extends React.Component {
.get('status'))
}
comments={comments.get('byId')}
onClickAction={(action, id) => this.onAction(action, id)}
actions={['reject', 'approve', 'banned']}
onClickAction={(action, id) => this.onCommentAction(action, id)}
actions={['reject', 'approve']}
loading={comments.loading} />
</div>
<div className={`mdl-tabs__panel ${styles.listContainer}`} id='rejected'>
+1 -9
View File
@@ -5,8 +5,7 @@ import {
FETCH_COMMENTERS_FAILURE,
FETCH_COMMENTERS_SUCCESS,
SORT_UPDATE,
SET_ROLE,
SET_STATUS
SET_ROLE
} from '../constants/community';
const initialState = Map({
@@ -46,13 +45,6 @@ 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)
+2 -16
View File
@@ -6,14 +6,7 @@
"newsroom_role": "Newsroom Role",
"admin": "Administrator",
"moderator": "Moderator",
"role": "Select role...",
"no-results": "No users found with that user name or email address.",
"status": "Status",
"select-status": "Select status...",
"active": "Active",
"banned": "Banned",
"banned-user": "Banned User",
"loading": "Loading results"
"role": "Select role..."
},
"modqueue": {
"pending": "pending",
@@ -58,14 +51,7 @@
"newsroom_role": "Rol en la redacción",
"admin": "Administrador",
"moderator": "Moderador",
"role": "Seleccionar rol...",
"no-results": "No se encontraron usuarios con ese nombre de usuario o correo electronico.",
"status": "Estado",
"select-status": "Seleccionar estado...",
"active": "Activa",
"banned": "Suspendido",
"banned-user": "Usuario Suspendido",
"loading": "Cargando resultados"
"role": "Select role..."
},
"modqueue": {
"pending": "pendiente",