Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP stag]Skip rendering IOU pay action for non-send money flow if the user needs to enable wallet or add bank account #30112

Merged
merged 5 commits into from
Oct 23, 2023
Merged
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
20 changes: 16 additions & 4 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -623,6 +623,18 @@ 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.report, 'isWaitingOnBankAccount', false) &&
techievivek marked this conversation as resolved.
Show resolved Hide resolved
originalMessage &&
originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY &&
!isSendingMoney
) {
return null;
}

const hasErrors = !_.isEmpty(props.action.errors);
const whisperedToAccountIDs = props.action.whisperedToAccountIDs || [];
const isWhisper = whisperedToAccountIDs.length > 0;
Expand Down
Loading