From 722a815399c53fb8abd460ccb5845a599113950b Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Sat, 21 Oct 2023 00:36:01 +0100 Subject: [PATCH 1/4] Check for isWaitingOnBankAccount --- src/pages/home/report/ReportActionItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index a22e0ea77e06..09adf9551fdf 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -626,7 +626,7 @@ function ReportActionItem(props) { // For the `pay` IOU action on non-send money flow we don't want to show anything // as the preview action is already shown by the create IOU action above - if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isSendingMoney) { + if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && lodashGet(props.iouReport, 'isWaitingOnBankAccount', false) && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isSendingMoney) { return null; } From b6f4bd17736e0fc246aa35e5dc109199b613ddbb Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Sat, 21 Oct 2023 12:57:29 +0530 Subject: [PATCH 2/4] update comments --- src/pages/home/report/ReportActionItem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 0616ec860241..bd1f269d96df 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -623,8 +623,8 @@ function ReportActionItem(props) { ); } - // For the `pay` IOU action on non-send money flow we don't want to show anything if we are waiting for the payee to add a bank account or wallet - // Otherwise we will see two system message informing user needs to add a bank account or wallet + // For the `pay` IOU action on non-send money flow, we don't want to render anything if `isWaitingOnBankAccount` is true + // Otherwise, we will see two system messages informing the payee needs to add a bank account or wallet if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && lodashGet(props.iouReport, 'isWaitingOnBankAccount', false) && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isSendingMoney) { return null; } From ba0660e6ed1db9f8eb8749e45f6d625e1dc608b4 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Sat, 21 Oct 2023 13:05:05 +0530 Subject: [PATCH 3/4] fix the eslint --- src/pages/home/report/ReportActionItem.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index bd1f269d96df..46fc1bd80f92 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -150,6 +150,10 @@ function ReportActionItem(props) { const isReportActionLinked = props.linkedReportActionID === props.action.reportActionID; const highlightedBackgroundColorIfNeeded = useMemo(() => (isReportActionLinked ? StyleUtils.getBackgroundColorStyle(themeColors.highlightBG) : {}), [isReportActionLinked]); + const originalMessage = lodashGet(props.action, 'originalMessage', {}); + + // IOUDetails only exists when we are sending money + const isSendingMoney = originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && _.has(originalMessage, 'IOUDetails'); // When active action changes, we need to update the `isContextMenuActive` state const isActiveReportActionForMenu = ReportActionContextMenu.isActiveReportAction(props.action.reportActionID); @@ -301,10 +305,6 @@ function ReportActionItem(props) { */ const renderItemContent = (hovered = false, isWhisper = false, hasErrors = false) => { let children; - const originalMessage = lodashGet(props.action, 'originalMessage', {}); - - // IOUDetails only exists when we are sending money - const isSendingMoney = originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && _.has(originalMessage, 'IOUDetails'); // Show the MoneyRequestPreview for when request was created, bill was split or money was sent if ( @@ -625,7 +625,7 @@ function ReportActionItem(props) { // For the `pay` IOU action on non-send money flow, we don't want to render anything if `isWaitingOnBankAccount` is true // Otherwise, we will see two system messages informing the payee needs to add a bank account or wallet - if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && lodashGet(props.iouReport, 'isWaitingOnBankAccount', false) && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isSendingMoney) { + if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && lodashGet(props.report, 'isWaitingOnBankAccount', false) && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isSendingMoney) { return null; } From d182a4f8858d3f1c34859e2b5f5c30dec0f220f0 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Sat, 21 Oct 2023 14:44:21 +0530 Subject: [PATCH 4/4] fix styling --- src/pages/home/report/ReportActionItem.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 46fc1bd80f92..4d73838fc529 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -623,9 +623,15 @@ function ReportActionItem(props) { ); } - // For the `pay` IOU action on non-send money flow, we don't want to render anything if `isWaitingOnBankAccount` is true + // For the `pay` IOU action on non-send money flow, we don't want to render anything if `isWaitingOnBankAccount` is true // Otherwise, we will see two system messages informing the payee needs to add a bank account or wallet - if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && lodashGet(props.report, 'isWaitingOnBankAccount', false) && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isSendingMoney) { + if ( + props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && + lodashGet(props.report, 'isWaitingOnBankAccount', false) && + originalMessage && + originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && + !isSendingMoney + ) { return null; }