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
3 changes: 2 additions & 1 deletion src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ function ReportPreview({

const shouldShowSettlementButton = (shouldShowPayButton || shouldShowApproveButton) && !showRTERViolationMessage && !shouldShowBrokenConnectionViolation;

const shouldPromptUserToAddBankAccount = ReportUtils.hasMissingPaymentMethod(userWallet, iouReportID) || ReportUtils.hasMissingInvoiceBankAccount(iouReportID);
const shouldPromptUserToAddBankAccount =
(ReportUtils.hasMissingPaymentMethod(userWallet, iouReportID) || ReportUtils.hasMissingInvoiceBankAccount(iouReportID)) && !ReportUtils.isSettled(iouReportID);
const shouldShowRBR = hasErrors && !iouSettled;

/*
Expand Down
8 changes: 6 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2801,15 +2801,19 @@ function getReasonAndReportActionThatRequiresAttention(
};
}

if (hasMissingInvoiceBankAccount(optionOrReport.reportID)) {
if (hasMissingInvoiceBankAccount(optionOrReport.reportID) && !isSettled(optionOrReport.reportID)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR added an unpaid-invoice condition next to the hasMissingInvoiceBankAccount check in both places in getReasonAndReportActionThatRequiresAttention. hasMissingInvoiceBankAccount only returns true for a paid invoice, so the combined condition could never be met.
That left the missing invoice bank account GBR check as dead code.

This was fixed here: #105696

More information is available here: https://github.com/Expensify/Expensify/issues/684654

return {
reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_MISSING_INVOICE_BANK_ACCOUNT,
};
}

if (isInvoiceRoom(optionOrReport)) {
const reportAction = Object.values(reportActions).find(
(action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && action.childReportID && hasMissingInvoiceBankAccount(action.childReportID),
(action) =>
action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW &&
action.childReportID &&
hasMissingInvoiceBankAccount(action.childReportID) &&
!isSettled(action.childReportID),
);

return reportAction
Expand Down
4 changes: 3 additions & 1 deletion src/pages/home/report/ReportActionItemMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ function ReportActionItemMessage({action, displayAsGroup, reportID, style, isHid
Navigation.navigate(ROUTES.WORKSPACE_INVOICES.getRoute(policyID));
};

const shouldShowAddBankAccountButton = action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && ReportUtils.hasMissingInvoiceBankAccount(reportID) && !ReportUtils.isSettled(reportID);

return (
<View style={[styles.chatItemMessage, style]}>
{!isHidden ? (
<>
{renderReportActionItemFragments(isApprovedOrSubmittedReportAction)}
{action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && ReportUtils.hasMissingInvoiceBankAccount(reportID) && (
{shouldShowAddBankAccountButton && (
<Button
style={[styles.mt2, styles.alignSelfStart]}
success
Expand Down
Loading