Renaming to commentClassNames

This commit is contained in:
Belen Curcio
2017-06-07 09:28:12 -03:00
parent b5c9e92cc6
commit e24f6ca9f1
8 changed files with 29 additions and 29 deletions
@@ -1,11 +1,11 @@
import {ADD_CLASSNAME, REMOVE_CLASSNAME} from '../constants/comment';
import {ADD_COMMENT_CLASSNAME, REMOVE_COMMENT_CLASSNAME} from '../constants/comment';
export const addClassName = (className) => ({
type: ADD_CLASSNAME,
export const addCommentClassName = (className) => ({
type: ADD_COMMENT_CLASSNAME,
className
});
export const removeClassName = (idx) => ({
type: REMOVE_CLASSNAME,
export const removeCommentClassName = (idx) => ({
type: REMOVE_COMMENT_CLASSNAME,
idx
});
@@ -169,11 +169,11 @@ export default class Comment extends React.Component {
activeReplyBox,
addNotification,
charCountEnable,
classNames = [],
showSignInDialog,
removeCommentTag,
commentIsIgnored,
setActiveReplyBox,
commentClassNames = []
} = this.props;
const flagSummary = getActionSummary('FlagActionSummary', comment);
@@ -237,7 +237,7 @@ export default class Comment extends React.Component {
* This will add myClassName to comments tagged with STAFF TAG.
* **/
const classNamesToAdd = classNames.reduce((acc, className) => {
const classNamesToAdd = commentClassNames.reduce((acc, className) => {
let res = [];
// Adding classNames based on tags
@@ -25,7 +25,7 @@ class Stream extends React.Component {
render() {
const {
classNames,
commentClassNames,
root: {asset, asset: {comments}, comment, me},
postComment,
addNotification,
@@ -158,7 +158,7 @@ class Stream extends React.Component {
return commentIsIgnored(comment)
? <IgnoredCommentTombstone key={comment.id} />
: <Comment
classNames={classNames}
commentClassNames={commentClassNames}
data={this.props.data}
root={this.props.root}
disableReply={!open}
@@ -1,2 +1,2 @@
export const ADD_CLASSNAME = 'ADD_CLASSNAME';
export const REMOVE_CLASSNAME = 'REMOVE_CLASSNAME';
export const ADD_COMMENT_CLASSNAME = 'ADD_COMMENT_CLASSNAME';
export const REMOVE_COMMENT_CLASSNAME = 'REMOVE_COMMENT_CLASSNAME';
@@ -323,7 +323,7 @@ const mapStateToProps = (state) => ({
assetUrl: state.stream.assetUrl,
activeTab: state.embed.activeTab,
previousTab: state.embed.previousTab,
classNames: state.comment.classNames
commentClassNames: state.comment.commentClassNames
});
const mapDispatchToProps = (dispatch) =>
@@ -1,22 +1,22 @@
import {ADD_CLASSNAME, REMOVE_CLASSNAME} from '../constants/comment';
import {ADD_COMMENT_CLASSNAME, REMOVE_COMMENT_CLASSNAME} from '../constants/comment';
const initialState = {
classNames: []
commentClassNames: []
};
export default function comment (state = initialState, action) {
switch (action.type) {
case ADD_CLASSNAME :
case ADD_COMMENT_CLASSNAME :
return {
...state,
classNames: [...state.classNames, action.className]
commentClassNames: [...state.commentClassNames, action.className]
};
case REMOVE_CLASSNAME :
case REMOVE_COMMENT_CLASSNAME :
return {
...state,
classNames: [
...state.classNames.slice(0, action.idx),
...state.classNames.slice(action.idx + 1)
commentClassNames: [
...state.commentClassNames.slice(0, action.idx),
...state.commentClassNames.slice(action.idx + 1)
]
};
default :
@@ -9,11 +9,11 @@ export default class OffTopicFilter extends React.Component {
handleChange = (e) => {
if (e.target.checked) {
this.props.addClassName(this.cn);
this.props.addCommentClassName(this.cn);
this.props.toggleCheckbox();
} else {
const idx = this.props.classNames.findIndex((i) => i[this.className]);
this.props.removeClassName(idx);
const idx = this.props.commentClassNames.findIndex((i) => i[this.className]);
this.props.removeCommentClassName(idx);
this.props.toggleCheckbox();
}
this.props.closeViewingOptions();
@@ -2,24 +2,24 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {toggleCheckbox} from '../actions';
import {
addClassName,
removeClassName
addCommentClassName,
removeCommentClassName
} from 'coral-embed-stream/src/actions/comment';
import OffTopicFilter from '../components/OffTopicFilter';
import {closeViewingOptions} from 'coral-embed-stream/src/actions/stream';
const mapStateToProps = ({comment, offTopic}) => ({
classNames: comment.classNames,
commentClassNames: comment.commentClassNames,
checked: offTopic.checked
});
const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
addClassName,
removeClassName,
toggleCheckbox,
closeViewingOptions
closeViewingOptions,
addCommentClassName,
removeCommentClassName
},
dispatch
);