Skip to content

Commit

Permalink
Merge pull request #23700 from Expensify/cmartins-fixPaidReportPreview
Browse files Browse the repository at this point in the history
Use stateNum to determine report state
  • Loading branch information
luacmartins authored Jul 28, 2023
2 parents 5132a6e + 910b134 commit 24ed1be
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function canEditReportAction(reportAction) {
*/
function isSettled(reportID) {
const report = lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {});
return !_.isEmpty(report) && !report.hasOutstandingIOU && !report.isWaitingOnBankAccount;
return !_.isEmpty(report) && !report.isWaitingOnBankAccount && report.stateNum > CONST.REPORT.STATE_NUM.PROCESSING;
}

/**
Expand Down Expand Up @@ -1223,14 +1223,12 @@ function getReportPreviewMessage(report, reportAction = {}) {
return Localize.translateLocal(translatePhraseKey, {amount: formattedAmount});
}

if (report.hasOutstandingIOU) {
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount});
}

if (report.isWaitingOnBankAccount) {
const submitterDisplayName = getDisplayNameForParticipant(report.ownerAccountID, true);
return Localize.translateLocal('iou.waitingOnBankAccount', {submitterDisplayName});
}

return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount});
}

/**
Expand Down

0 comments on commit 24ed1be

Please sign in to comment.