Skip to content

Commit

Permalink
integrate isProcessingReport helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Dec 11, 2023
1 parent ad9d3c2 commit 9939213
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,13 @@ function isConciergeChatReport(report: OnyxEntry<Report>): boolean {
return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report);
}

/**
* Returns true if report is still being processed
*/
function isProcessingReport(report: OnyxEntry<Report>): boolean {
return report?.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && report?.statusNum === CONST.REPORT.STATUS.SUBMITTED;
}

/**
* Check if the report is a single chat report that isn't a thread
* and personal detail of participant is optimistic data
Expand Down Expand Up @@ -1725,7 +1732,7 @@ function getMoneyRequestReportName(report: OnyxEntry<Report>, policy: OnyxEntry<
return Localize.translateLocal('iou.payerSpentAmount', {payer: payerName, amount: formattedAmount});
}

if ((report?.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && report?.statusNum === CONST.REPORT.STATUS.SUBMITTED) || isDraftExpenseReport(report) || moneyRequestTotal === 0) {
if (isProcessingReport(report) || isDraftExpenseReport(report) || moneyRequestTotal === 0) {
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount});
}

Expand Down Expand Up @@ -4339,6 +4346,7 @@ export {
isPublicRoom,
isPublicAnnounceRoom,
isConciergeChatReport,
isProcessingReport,
isCurrentUserTheOnlyParticipant,
hasAutomatedExpensifyAccountIDs,
hasExpensifyGuidesEmails,
Expand Down

0 comments on commit 9939213

Please sign in to comment.