Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/libs/ReportActionsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ function getSortedReportActions(reportActions) {
* Finds most recent IOU report action number.
*
* @param {Array} reportActions
* @returns {Number}
* @returns {String}
*/
function getMostRecentIOUReportSequenceNumber(reportActions) {
function getMostRecentIOUReportActionID(reportActions) {
return _.chain(reportActions)
.sortBy('sequenceNumber')
.filter(action => action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU)
.where({actionName: CONST.REPORT.ACTIONS.TYPE.IOU})
.max(action => action.sequenceNumber)
.value().sequenceNumber;
.value().reportActionID;
}

/**
Expand Down Expand Up @@ -151,7 +150,7 @@ export {
getOptimisticLastReadSequenceNumberForDeletedAction,
getLastVisibleMessageText,
getSortedReportActions,
getMostRecentIOUReportSequenceNumber,
getMostRecentIOUReportActionID,
isDeletedAction,
isConsecutiveActionMadeByPreviousActor,
};
8 changes: 4 additions & 4 deletions src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const propTypes = {
action: PropTypes.shape(reportActionPropTypes),
})).isRequired,

/** The sequence number of the most recent IOU report connected with the shown report */
mostRecentIOUReportSequenceNumber: PropTypes.number,
/** The ID of the most recent IOU report action connected with the shown report */
mostRecentIOUReportActionID: PropTypes.string,

/** Are we loading more report actions? */
isLoadingMoreReportActions: PropTypes.bool,
Expand All @@ -59,7 +59,7 @@ const propTypes = {

const defaultProps = {
personalDetails: {},
mostRecentIOUReportSequenceNumber: undefined,
mostRecentIOUReportActionID: '',
isLoadingMoreReportActions: false,
};

Expand Down Expand Up @@ -139,7 +139,7 @@ class ReportActionsList extends React.Component {
action={item.action}
displayAsGroup={ReportActionsUtils.isConsecutiveActionMadeByPreviousActor(this.props.sortedReportActions, index)}
shouldDisplayNewIndicator={shouldDisplayNewIndicator}
isMostRecentIOUReportAction={item.action.sequenceNumber === this.props.mostRecentIOUReportSequenceNumber}
isMostRecentIOUReportAction={item.action.reportActionID === this.props.mostRecentIOUReportActionID}
hasOutstandingIOU={this.props.report.hasOutstandingIOU}
index={index}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ReportActionsView extends React.Component {

this.currentScrollOffset = 0;
this.sortedReportActions = ReportActionsUtils.getSortedReportActions(props.reportActions);
this.mostRecentIOUReportSequenceNumber = ReportActionsUtils.getMostRecentIOUReportSequenceNumber(props.reportActions);
this.mostRecentIOUReportActionID = ReportActionsUtils.getMostRecentIOUReportActionID(props.reportActions);
this.trackScroll = this.trackScroll.bind(this);
this.toggleFloatingMessageCounter = this.toggleFloatingMessageCounter.bind(this);
this.loadMoreChats = this.loadMoreChats.bind(this);
Expand Down Expand Up @@ -142,7 +142,7 @@ class ReportActionsView extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
if (!_.isEqual(nextProps.reportActions, this.props.reportActions)) {
this.sortedReportActions = ReportActionsUtils.getSortedReportActions(nextProps.reportActions);
this.mostRecentIOUReportSequenceNumber = ReportActionsUtils.getMostRecentIOUReportSequenceNumber(nextProps.reportActions);
this.mostRecentIOUReportActionID = ReportActionsUtils.getMostRecentIOUReportActionID(nextProps.reportActions);
return true;
}

Expand Down Expand Up @@ -367,7 +367,7 @@ class ReportActionsView extends React.Component {
onScroll={this.trackScroll}
onLayout={this.recordTimeToMeasureItemLayout}
sortedReportActions={this.sortedReportActions}
mostRecentIOUReportSequenceNumber={this.mostRecentIOUReportSequenceNumber}
mostRecentIOUReportActionID={this.mostRecentIOUReportActionID}
isLoadingMoreReportActions={this.props.report.isLoadingMoreReportActions}
loadMoreChats={this.loadMoreChats}
newMarkerSequenceNumber={this.state.newMarkerSequenceNumber}
Expand Down