Pluralizing user item_type for consistency.

This commit is contained in:
David Jay
2017-01-09 17:43:39 -05:00
parent b8fc2c9cc7
commit 9809403701
6 changed files with 16 additions and 13 deletions
@@ -130,9 +130,9 @@ export default class ModerationList extends React.Component {
}
// Update the status right away if this is a comment
if (action.item_type === 'comment') {
if (action.item_type === 'comments') {
this.props.updateCommentStatus(menuOption, id);
} else if (action.item_type === 'user') {
} else if (action.item_type === 'users') {
// If a user bio or name is rejected, bring up a dialog before suspending them.
if (menuOption === 'rejected') {
@@ -195,11 +195,15 @@ export default class ModerationList extends React.Component {
getModerationIds = () => {
const {commentIds = [], actionIds = [], comments, actions} = this.props;
return [ ...commentIds, ...actionIds ].sort((a, b) => {
const itemA = comments[a] || actions[a];
const itemB = comments[b] || actions[b];
return itemB.updated_at - itemA.updated_at;
});
if (comments && actions) {
return [ ...commentIds, ...actionIds ].sort((a, b) => {
const itemA = comments[a] || actions[a];
const itemB = comments[b] || actions[b];
return itemB.updated_at - itemA.updated_at;
});
} else {
return commentIds || actionIds;
}
}
render () {
@@ -19,7 +19,6 @@ const UserAction = props => {
const links = user.settings.bio ? linkify.getMatches(user.settings.bio) : [];
//Do not display if the user status is 'active'. This means that they have already been reviewed and approved.
return userStatus !== 'active' &&
<li tabIndex={props.index} className={`${styles.listItem} ${props.isActive && !props.hideActive ? styles.activeItem : ''}`}>
<div className={styles.itemHeader}>
@@ -66,7 +66,7 @@ class ModerationContainer extends React.Component {
const premodIds = comments.ids.filter(id => comments.byId[id].status === 'premod');
const rejectedIds = comments.ids.filter(id => comments.byId[id].status === 'rejected');
const flaggedIds = comments.ids.filter(id => comments.byId[id].flagged === true);
const userActionIds = actions.ids.filter(id => actions.byId[id].item_type === 'user');
const userActionIds = actions.ids.filter(id => actions.byId[id].item_type === 'users');
return (
<ModerationQueue
+1 -1
View File
@@ -9,7 +9,7 @@ const getPopupMenu = [
() => {
return {
header: lang.t('step-2-header'),
itemType: 'user',
itemType: 'users',
field: 'bio',
options: [
{val: 'This bio is offensive', text: lang.t('bio-offensive')},
+2 -2
View File
@@ -47,7 +47,7 @@ class FlagButton extends Component {
case 'comments':
item_id = id;
break;
case 'user':
case 'users':
item_id = author_id;
break;
}
@@ -72,7 +72,7 @@ class FlagButton extends Component {
onPopupOptionClick = (sets) => (e) => {
// If flagging a user, indicate that this is referencing the username rather than the bio
if(sets === 'itemType' && e.target.value === 'user') {
if(sets === 'itemType' && e.target.value === 'users') {
this.setState({field: 'username'});
}
+1 -1
View File
@@ -10,7 +10,7 @@ const getPopupMenu = [
return {
header: lang.t('step-1-header'),
options: [
{val: 'user', text: lang.t('flag-username')},
{val: 'users', text: lang.t('flag-username')},
{val: 'comments', text: lang.t('flag-comment')}
],
button: lang.t('continue'),