Skip to content

Commit

Permalink
Merge pull request #4865 from parasharrajat/markercount
Browse files Browse the repository at this point in the history
fix count when LHN is open on mobile

(cherry picked from commit 7e55635)
  • Loading branch information
roryabraham authored and OSBotify committed Aug 27, 2021
1 parent b2a707d commit 7cf6307
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,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
Expand Down Expand Up @@ -390,9 +390,14 @@ class ReportActionsView extends React.Component {

/**
* Update the unread messages count to show in the MarkerBadge
* @param {Boolean} [shouldResetLocalCount=false] Whether count should increment or reset
*/
updateLocalUnreadActionCount() {
this.setState(prevState => ({localUnreadActionCount: prevState.localUnreadActionCount + this.props.report.unreadActionCount}));
updateLocalUnreadActionCount(shouldResetLocalCount = false) {
this.setState(prevState => ({
localUnreadActionCount: shouldResetLocalCount
? this.props.report.unreadActionCount
: prevState.localUnreadActionCount + this.props.report.unreadActionCount,
}));
}

/**
Expand Down

0 comments on commit 7cf6307

Please sign in to comment.