From 5c441e90e7cf932de9103b13399ea8b65e36a6e5 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Fri, 24 Feb 2017 13:08:48 -0700 Subject: [PATCH] do not update countCache if the CommentBox is in a reply --- client/coral-plugin-commentbox/CommentBox.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 3d895df07..f7444437e 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -30,6 +30,7 @@ class CommentBox extends Component { postItem, assetId, updateCountCache, + isReply, countCache, parentId, addNotification, @@ -46,17 +47,17 @@ class CommentBox extends Component { if (this.props.charCount && this.state.body.length > this.props.charCount) { return; } - updateCountCache(assetId, countCache + 1); + !isReply && updateCountCache(assetId, countCache + 1); postItem(comment, 'comments') .then(({data}) => { const postedComment = data.createComment.comment; if (postedComment.status === 'REJECTED') { addNotification('error', lang.t('comment-post-banned-word')); - updateCountCache(assetId, countCache); + !isReply && updateCountCache(assetId, countCache); } else if (postedComment.status === 'PREMOD') { addNotification('success', lang.t('comment-post-notif-premod')); - updateCountCache(assetId, countCache); + !isReply && updateCountCache(assetId, countCache); } else { addNotification('success', 'Your comment has been posted.'); }