diff --git a/client/coral-embed-stream/src/reducers/stream.js b/client/coral-embed-stream/src/reducers/stream.js index 9e03e3528..2d6e3e8b2 100644 --- a/client/coral-embed-stream/src/reducers/stream.js +++ b/client/coral-embed-stream/src/reducers/stream.js @@ -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, diff --git a/client/coral-plugin-replies/ReplyBox.js b/client/coral-plugin-replies/ReplyBox.js index 97667f932..8241bf511 100644 --- a/client/coral-plugin-replies/ReplyBox.js +++ b/client/coral-plugin-replies/ReplyBox.js @@ -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}