Merge pull request #664 from coralproject/fix-reply-bugs

Fix bugs related to reply box
This commit is contained in:
Kim Gardner
2017-06-08 11:09:10 -04:00
committed by GitHub
2 changed files with 11 additions and 8 deletions
@@ -1,4 +1,5 @@
import * as actions from '../constants/stream';
import * as authActions from 'coral-framework/constants/auth';
function getQueryVariable(variable) {
let query = window.location.search.substring(1);
@@ -16,7 +17,6 @@ function getQueryVariable(variable) {
const initialState = {
activeReplyBox: '',
commentCountCache: -1,
assetId: getQueryVariable('asset_id'),
assetUrl: getQueryVariable('asset_url'),
commentId: getQueryVariable('comment_id'),
@@ -25,16 +25,16 @@ const initialState = {
export default function stream(state = initialState, action) {
switch (action.type) {
case authActions.LOGOUT:
return {
...state,
activeReplyBox: '',
};
case actions.SET_ACTIVE_REPLY_BOX:
return {
...state,
activeReplyBox: action.id,
};
case actions.SET_COMMENT_COUNT_CACHE:
return {
...state,
commentCountCache: action.amount,
};
case actions.VIEW_ALL_COMMENTS:
return {
...state,
+5 -2
View File
@@ -9,6 +9,10 @@ class ReplyBox extends Component {
document.getElementById('replyText').focus();
}
cancelReply = () => {
this.props.setActiveReplyBox('');
};
render() {
const {
styles,
@@ -18,7 +22,6 @@ class ReplyBox extends Component {
addNotification,
parentId,
commentPostedHandler,
setActiveReplyBox,
maxCharCount,
charCountEnable
} = this.props;
@@ -28,7 +31,7 @@ class ReplyBox extends Component {
charCountEnable={charCountEnable}
commentPostedHandler={commentPostedHandler}
parentId={parentId}
cancelButtonClicked={setActiveReplyBox}
cancelButtonClicked={this.cancelReply}
addNotification={addNotification}
authorId={authorId}
assetId={assetId}