From 8849dcbf5c1d1d975c20ea33029c9e80723cc213 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 20 Dec 2016 10:29:49 -0700 Subject: [PATCH] add propTypes to CommentList --- .../coral-admin/src/components/CommentList.js | 33 ++++++++++++++++--- .../ModerationQueue/ModerationQueue.js | 9 ++++- client/coral-admin/src/translations.json | 4 +-- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/client/coral-admin/src/components/CommentList.js b/client/coral-admin/src/components/CommentList.js index 597ea62a6..4f1d75d81 100644 --- a/client/coral-admin/src/components/CommentList.js +++ b/client/coral-admin/src/components/CommentList.js @@ -1,5 +1,4 @@ - -import React from 'react'; +import React, {PropTypes} from 'react'; import styles from './CommentList.css'; import key from 'keymaster'; import Hammer from 'hammerjs'; @@ -15,6 +14,28 @@ const actions = { // Renders a comment list and allow performing actions export default class CommentList extends React.Component { + static propTypes = { + isActive: PropTypes.bool, + singleView: PropTypes.bool, + commentIds: PropTypes.arrayOf(PropTypes.string).isRequired, + comments: PropTypes.object.isRequired, + users: PropTypes.object.isRequired, + onClickAction: PropTypes.func, + actions: PropTypes.arrayOf(PropTypes.string), + loading: PropTypes.bool, + // list of actions (flags, etc) associated with the comments + commentActions: PropTypes.arrayOf( + PropTypes.shape({ + action_type: PropTypes.string, + count: PropTypes.number, + current_user: PropTypes.string, + item_id: PropTypes.string, + item_type: PropTypes.string + }) + ), + suspectWords: PropTypes.arrayOf(PropTypes.string) + } + constructor (props) { super(props); @@ -122,7 +143,7 @@ export default class CommentList extends React.Component { } render () { - const {singleView, commentIds, comments, users, hideActive, key} = this.props; + const {singleView, commentIds, comments, users, hideActive, key, suspectWords, commentActions} = this.props; const {active} = this.state; return ( @@ -130,7 +151,11 @@ export default class CommentList extends React.Component { {commentIds.map((commentId, index) => { const comment = comments[commentId]; const author = users[comment.author_id]; - return action.item_id === commentId); + return 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); @@ -108,6 +110,8 @@ class ModerationQueue extends React.Component {
({ + settings: state.settings.toJS(), comments: state.comments.toJS(), users: state.users.toJS() }); diff --git a/client/coral-admin/src/translations.json b/client/coral-admin/src/translations.json index 028392497..eee0bc443 100644 --- a/client/coral-admin/src/translations.json +++ b/client/coral-admin/src/translations.json @@ -49,9 +49,9 @@ "comment-settings": "Comment Settings", "embed-comment-stream": "Embed Comment Stream", "banned-word-header": "Write the bannned words list", - "banned-word-text": "Comments which contain these words or phrases, not separated by commas and not case-sensitive, will be automatically removed from the comment stream.", + "banned-word-text": "Comments which contain these words or phrases (not case-sensitive) will be automatically removed from the comment stream.", "suspect-word-header": "Write the suspect words list", - "suspect-word-text": "Comments which contain these words or phrases, not separated by commas and not case-sensitive will be highlighted in the comment stream", + "suspect-word-text": "Comments which contain these words or phrases (not case-sensitive) will be highlighted in the comment stream", "wordlist": "Banned & Suspect Words", "banned-words-title": "Banned words list", "suspect-words-title": "Suspect words list",