From 2b7fade13ea1267ce903923190514a05253ee516 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Fri, 27 Aug 2021 04:49:27 +0530 Subject: [PATCH 1/2] fix: count when LHN is open on mobile --- src/pages/home/report/ReportActionsView.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index aece1b7885f..9245c7a764f 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -209,7 +209,7 @@ class ReportActionsView extends React.Component { // Only update the unread count when MarkerBadge is visible // Otherwise marker will be shown on scrolling up from the bottom even if user have read those messages if (this.state.isMarkerActive) { - this.updateLocalUnreadActionCount(); + this.updateLocalUnreadActionCount(shouldRecordMaxAction); } // show new MarkerBadge when there is a new message @@ -389,9 +389,14 @@ class ReportActionsView extends React.Component { /** * Update the unread messages count to show in the MarkerBadge + * @param {Boolean} [incrementCount=true] Whether count should increment or reset */ - updateLocalUnreadActionCount() { - this.setState(prevState => ({localUnreadActionCount: prevState.localUnreadActionCount + this.props.report.unreadActionCount})); + updateLocalUnreadActionCount(incrementCount = true) { + this.setState(prevState => ({ + localUnreadActionCount: incrementCount + ? prevState.localUnreadActionCount + this.props.report.unreadActionCount + : this.props.report.unreadActionCount, + })); } /** From 8b520728d6f04a1c7b83d9002fc65712847ae69c Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Fri, 27 Aug 2021 05:57:01 +0530 Subject: [PATCH 2/2] changes --- src/pages/home/report/ReportActionsView.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index 9245c7a764f..98a4825cb4d 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -209,7 +209,7 @@ class ReportActionsView extends React.Component { // Only update the unread count when MarkerBadge is visible // Otherwise marker will be shown on scrolling up from the bottom even if user have read those messages if (this.state.isMarkerActive) { - this.updateLocalUnreadActionCount(shouldRecordMaxAction); + this.updateLocalUnreadActionCount(!shouldRecordMaxAction); } // show new MarkerBadge when there is a new message @@ -389,13 +389,13 @@ class ReportActionsView extends React.Component { /** * Update the unread messages count to show in the MarkerBadge - * @param {Boolean} [incrementCount=true] Whether count should increment or reset + * @param {Boolean} [shouldResetLocalCount=false] Whether count should increment or reset */ - updateLocalUnreadActionCount(incrementCount = true) { + updateLocalUnreadActionCount(shouldResetLocalCount = false) { this.setState(prevState => ({ - localUnreadActionCount: incrementCount - ? prevState.localUnreadActionCount + this.props.report.unreadActionCount - : this.props.report.unreadActionCount, + localUnreadActionCount: shouldResetLocalCount + ? this.props.report.unreadActionCount + : prevState.localUnreadActionCount + this.props.report.unreadActionCount, })); }