Skip to content

Commit

Permalink
Make getContinuousReportActionChain consider any optimistic action
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Mar 25, 2024
1 parent b25eb15 commit ced6292
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,12 @@ function getSortedReportActions(reportActions: ReportAction[] | null, shouldSort
function getContinuousReportActionChain(sortedReportActions: ReportAction[], id?: string): ReportAction[] {
let index;

console.log('RORY_DEBUG sortedReportActions', sortedReportActions);

Check failure on line 265 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement

if (id) {
index = sortedReportActions.findIndex((obj) => obj.reportActionID === id);
} else {
index = sortedReportActions.findIndex((obj) => obj.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);
index = sortedReportActions.findIndex((obj) => obj.pendingAction === null);
}

if (index === -1) {
Expand Down Expand Up @@ -298,12 +300,14 @@ function getContinuousReportActionChain(sortedReportActions: ReportAction[], id?
// This additional check is to include recently sent messages that might not yet be part of the established sequence.
while (
(startIndex > 0 && sortedReportActions[startIndex].reportActionID === sortedReportActions[startIndex - 1].previousReportActionID) ||
sortedReportActions[startIndex - 1]?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD ||
sortedReportActions[startIndex - 1]?.pendingAction !== null ||
sortedReportActions[startIndex - 1]?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM
) {
startIndex--;
}

console.log('RORY_DEBUG continuous reportAction chain', sortedReportActions.slice(startIndex, endIndex + 1));

Check failure on line 309 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement

return sortedReportActions.slice(startIndex, endIndex + 1);
}

Expand Down

0 comments on commit ced6292

Please sign in to comment.