From 6b77cb2bfaa81d0755005884867abb2d2c962e9b Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 11 Mar 2022 12:09:18 +0800 Subject: [PATCH] Fix comment count not incremented when it was previously 0 It was causing the nudge to add a comment to still appear after one has just entered a comment. Ticket: 928 --- ui/redux/reducers/comments.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/redux/reducers/comments.js b/ui/redux/reducers/comments.js index 0c3acf00d..9823a4ca0 100644 --- a/ui/redux/reducers/comments.js +++ b/ui/redux/reducers/comments.js @@ -120,7 +120,7 @@ export default handleActions( newCommentIds.unshift(comment.comment_id); byId[claimId] = newCommentIds; - if (totalCommentsById[claimId]) { + if (totalCommentsById.hasOwnProperty(claimId)) { totalCommentsById[claimId] += 1; } @@ -596,7 +596,7 @@ export default handleActions( } } - if (totalCommentsById[claimId]) { + if (totalCommentsById.hasOwnProperty(claimId)) { totalCommentsById[claimId] = Math.max(0, totalCommentsById[claimId] - 1); }