Skip to content

Commit

Permalink
Merge pull request #15144 from s77rt/unread-indicator-after-delete
Browse files Browse the repository at this point in the history
Recalculate new marker indicator if current one is deleted
  • Loading branch information
neil-marcellini authored Feb 15, 2023
2 parents 278e2fb + b8b29e4 commit f9ded9c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@ class ReportActionsView extends React.Component {
this.openReportIfNecessary();
}

// If the report is unread, we want to check if the number of actions has decreased. If so, then it seems that one of them was deleted. In this case, if the deleted action was the
// one marking the unread point, we need to recalculate which action should be the unread marker.
if (ReportUtils.isUnread(this.props.report) && ReportActionsUtils.filterReportActionsForDisplay(prevProps.reportActions).length > this.sortedAndFilteredReportActions.length) {
this.setState({newMarkerReportActionID: ReportUtils.getNewMarkerReportActionID(this.props.report, this.sortedAndFilteredReportActions)});
// If the report action marking the unread point is deleted we need to recalculate which action should be the unread marker
if (this.state.newMarkerReportActionID && _.isEmpty(lodashGet(this.props.reportActions[this.state.newMarkerReportActionID], 'message[0].html'))) {
this.setState({
newMarkerReportActionID: ReportUtils.getNewMarkerReportActionID(this.props.report, this.sortedAndFilteredReportActions),
});
}

// When the user navigates to the LHN the ReportActionsView doesn't unmount and just remains hidden.
Expand Down

0 comments on commit f9ded9c

Please sign in to comment.