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

Handle isWaitingOnBankAccount for IOU requests #20821

Merged
merged 77 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
cd6dba8
Handle isWaitingForBankAccount when paying request
nkuoch Jun 21, 2023
e84fc71
Handle reimbursed action
nkuoch Jun 22, 2023
c370ea9
Some cleaning
nkuoch Jun 22, 2023
0418d9a
Add translations
nkuoch Jun 27, 2023
f9a0756
New copies
nkuoch Jun 29, 2023
483a029
Merge branch 'main' into nat-iouw
nkuoch Jun 30, 2023
be5f7cc
js style
nkuoch Jun 30, 2023
a656df2
Merge branch 'main' into nat-iouw
nkuoch Jul 4, 2023
ff482ab
Use getMoneyRequestTotal for displayed amount
nkuoch Jul 4, 2023
ffdbf1a
Fix console error by adding report billing state
nkuoch Jul 4, 2023
2f1a1b2
Fix eslint
nkuoch Jul 4, 2023
f68a275
Some refactoring
nkuoch Jul 4, 2023
53717db
Use button instead of link to add a bank account
nkuoch Jul 4, 2023
7d5150f
No need to show green dot on parent report
nkuoch Jul 4, 2023
abcaacd
Small fixes from Carlos PR review
nkuoch Jul 4, 2023
4efa13b
Merge branch 'main' into nat-iouw
nkuoch Jul 4, 2023
c39b697
Fix lint
nkuoch Jul 4, 2023
3d7f396
js prettier
nkuoch Jul 4, 2023
2927f9a
Move addbankaccount button to MoneyRequestHeader and create generic R…
nkuoch Jul 5, 2023
c13502a
Fix tests and style
nkuoch Jul 5, 2023
d586383
If current user already has a iou waitingForBankAccount, prevent reus…
nkuoch Jul 7, 2023
f00bc0b
Some refactoring
nkuoch Jul 7, 2023
d440b61
Merge branch 'main' into nat-iouw
nkuoch Jul 7, 2023
67e19ad
Show green dot when admin needs to pay his own request
nkuoch Jul 7, 2023
ad9dacc
Add button back to reportAction level
nkuoch Jul 7, 2023
dc64d3f
Merge branch 'main' into nat-iouw
nkuoch Jul 7, 2023
d7ce6ce
Fix test
nkuoch Jul 7, 2023
5bc651a
prettier
nkuoch Jul 7, 2023
32acf1c
Fix tests
nkuoch Jul 7, 2023
bedc151
Rename method to hasIouWaitingOnCurrentUserBankAccount
nkuoch Jul 9, 2023
41d7bb3
Prettier
nkuoch Jul 9, 2023
b1cde86
Small fixes
nkuoch Jul 9, 2023
284ce2f
Prettier
nkuoch Jul 10, 2023
218d88a
Merge branch 'main' into nat-iouw
nkuoch Jul 11, 2023
aa2c40f
Dont show green button on chat report for isWaitingOnBankAccount case
nkuoch Jul 11, 2023
19df18a
Default report preview amount to the one from the report action if io…
nkuoch Jul 11, 2023
d8f75d5
Dont show green button on chat report for isWaitingOnBankAccount case
nkuoch Jul 11, 2023
840587d
Default report preview amount to the one from the report action if io…
nkuoch Jul 11, 2023
4449a86
Make sure we close the modal after clicking on Continue
nkuoch Jul 11, 2023
821628b
Merge branch 'main' into nat-iouw
nkuoch Jul 12, 2023
ad62d24
Fix missing iou amount
nkuoch Jul 12, 2023
4984806
Fix merge conflict
nkuoch Jul 12, 2023
77783a4
Merge branch 'nat-iouw' of github.com:Expensify/App into nat-iouw
nkuoch Jul 12, 2023
9f90c9f
prettier
nkuoch Jul 12, 2023
7f729f6
Merge branch 'vit-bumpOnyxVersion' into nat-iouw
nkuoch Jul 13, 2023
627f4cd
Merge branch 'main' into nat-iouw
nkuoch Jul 13, 2023
cae3c44
shouldShowGreenDotIndicator needs managerID in optionItem
nkuoch Jul 14, 2023
b889078
Fix unit test
nkuoch Jul 14, 2023
87eb926
Fix ioupreview amount for other types of messages
nkuoch Jul 14, 2023
4549681
Fix preview message
nkuoch Jul 14, 2023
7f1b9e7
Close modal to show report only if coming from click from button from…
nkuoch Jul 14, 2023
fbe5aed
Fix eslint
nkuoch Jul 14, 2023
caa301b
If no iouReport to get managerID from, get actorAccountID from report…
nkuoch Jul 14, 2023
cf72cc1
Update src/components/ReportActionItem/ReportPreview.js
nkuoch Jul 14, 2023
043398d
Fixes from Carlos PR review
nkuoch Jul 14, 2023
f40658c
Dont show settlement button if we dont have the ioureport
nkuoch Jul 15, 2023
bde5c68
Global create update
mountiny Jul 17, 2023
9370590
Resolve merge conflicts
mountiny Jul 17, 2023
35923fd
Merge branch 'main' into nat-iouw
mountiny Jul 17, 2023
05a7eab
Fix linter
mountiny Jul 17, 2023
e3513f5
Resolve merge conflicts
mountiny Jul 17, 2023
ba7f911
Update tests
mountiny Jul 17, 2023
40e6d86
Update the tests
mountiny Jul 17, 2023
5845661
Resolve merge conflicts
mountiny Jul 18, 2023
c1b8d6e
Remove duplicate single transaction details
mountiny Jul 18, 2023
8234369
Merge branch 'main' into nat-iouw
nkuoch Jul 19, 2023
871821f
Fix merge conflict
nkuoch Jul 19, 2023
05f270b
Fix cannot read property of null
nkuoch Jul 19, 2023
dfa3230
Revert console.log
nkuoch Jul 19, 2023
58bf070
Import underscore
nkuoch Jul 19, 2023
405f470
Merge branch 'main' into nat-iouw
nkuoch Jul 20, 2023
91a40c5
Fix merge conflict
nkuoch Jul 20, 2023
2f48cd2
Fix eslint
nkuoch Jul 20, 2023
3c45555
Merge branch 'main' into nat-iouw
nkuoch Jul 24, 2023
388d977
Fix addBankAccount button still visible after user adds a bank account
nkuoch Jul 24, 2023
1158139
Only show iou.pay, not reimbursed action to avoid duplicate message
nkuoch Jul 24, 2023
6462b40
Fix test
nkuoch Jul 25, 2023
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
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ const CONST = {
TASKEDITED: 'TASKEDITED',
TASKCANCELLED: 'TASKCANCELLED',
IOU: 'IOU',
REIMBURSEMENTQUEUED: 'REIMBURSEMENTQUEUED',
RENAMED: 'RENAMED',
CHRONOSOOOLIST: 'CHRONOSOOOLIST',
TASKCOMPLETED: 'TASKCOMPLETED',
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class AddPlaidBankAccount extends React.Component {
token={token}
onSuccess={({publicToken, metadata}) => {
Log.info('[PlaidLink] Success!');
BankAccounts.openPlaidBankAccountSelector(publicToken, metadata.institution.name, this.props.allowDebit);
BankAccounts.openPlaidBankAccountSelector(publicToken, metadata.institution.name, this.props.allowDebit, this.props.bankAccountID);
}}
onError={(error) => {
Log.hmmm('[PlaidLink] Error: ', error.message);
Expand Down
3 changes: 2 additions & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import PressableWithSecondaryInteraction from '../PressableWithSecondaryInteract
import * as ReportActionContextMenu from '../../pages/home/report/ContextMenu/ReportActionContextMenu';
import * as ContextMenuActions from '../../pages/home/report/ContextMenu/ContextMenuActions';
import * as OptionsListUtils from '../../libs/OptionsListUtils';
import * as ReportUtils from '../../libs/ReportUtils';
import useLocalize from '../../hooks/useLocalize';

const propTypes = {
Expand Down Expand Up @@ -90,7 +91,7 @@ function OptionRowLHN(props) {
const shouldShowGreenDotIndicator =
!hasBrickError &&
(optionItem.isUnreadWithMention ||
(optionItem.hasOutstandingIOU && !optionItem.isIOUReportOwner) ||
ReportUtils.isWaitingForIOUActionFromCurrentUser(optionItem) ||
(optionItem.isTaskReport && optionItem.isTaskAssignee && !optionItem.isCompletedTaskReport && !optionItem.isArchivedRoom));

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyReportHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function MoneyReportHeader(props) {
const policy = props.policies[`${ONYXKEYS.COLLECTION.POLICY}${props.report.policyID}`];
const isPayer =
Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(moneyRequestReport) && lodashGet(props.session, 'accountID', null) === moneyRequestReport.managerID);
const shouldShowSettlementButton = !isSettled && isPayer;
const shouldShowSettlementButton = !isSettled && isPayer && !moneyRequestReport.isWaitingOnBankAccount;
const bankAccountRoute = ReportUtils.getBankAccountRoute(props.chatReport);
const shouldShowPaypal = Boolean(lodashGet(props.personalDetails, [moneyRequestReport.managerID, 'payPalMeAddress']));
const formattedAmount = CurrencyUtils.convertToDisplayString(ReportUtils.getMoneyRequestTotal(props.report), props.report.currency);
Expand Down
11 changes: 9 additions & 2 deletions src/components/MoneyRequestDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ function MoneyRequestDetails(props) {
: UserUtils.getAvatar(lodashGet(props.personalDetails, [moneyRequestReport.managerID, 'avatar']), moneyRequestReport.managerID);
const isPayer =
Policy.isAdminOfFreePolicy([props.policy]) || (ReportUtils.isMoneyRequestReport(moneyRequestReport) && lodashGet(props.session, 'accountID', null) === moneyRequestReport.managerID);
const shouldShowSettlementButton = !isSettled && !props.isSingleTransactionView && isPayer;
const shouldShowSettlementButton = moneyRequestReport.reportID && !isSettled && !props.isSingleTransactionView && isPayer && !moneyRequestReport.isWaitingOnBankAccount;
const bankAccountRoute = ReportUtils.getBankAccountRoute(props.chatReport);
const shouldShowPaypal = Boolean(lodashGet(props.personalDetails, [moneyRequestReport.ownerAccountID, 'payPalMeAddress']));
let description = `${props.translate('iou.amount')} • ${props.translate('iou.cash')}`;
if (isSettled) {
description += ` • ${props.translate('iou.settledExpensify')}`;
} else if (props.report.isWaitingOnBankAccount) {
description += ` • ${props.translate('iou.pending')}`;
}

const {addWorkspaceRoomOrChatPendingAction, addWorkspaceRoomOrChatErrors} = ReportUtils.getReportOfflinePendingActionAndErrors(props.report);
return (
<OfflineWithFeedback
Expand Down Expand Up @@ -174,7 +181,7 @@ function MoneyRequestDetails(props) {
title={formattedTransactionAmount}
shouldShowTitleIcon={isSettled}
titleIcon={Expensicons.Checkmark}
description={`${props.translate('iou.amount')} • ${props.translate('iou.cash')}${isSettled ? ` • ${props.translate('iou.settledExpensify')}` : ''}`}
description={description}
titleStyle={styles.newKansasLarge}
disabled={isSettled}
// Note: These options are temporarily disabled while we figure out the required API changes
Expand Down
10 changes: 8 additions & 2 deletions src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ function IOUPreview(props) {
return props.translate('iou.split');
}

return `${props.translate('iou.cash')}${!props.iouReport.hasOutstandingIOU ? ` • ${props.translate('iou.settledExpensify')}` : ''}`;
let message = props.translate('iou.cash');
if (props.iouReport.isWaitingOnBankAccount) {
message += ` • ${props.translate('iou.pending')}`;
} else if (ReportUtils.isSettled(props.iouReport.reportID)) {
message += ` • ${props.translate('iou.settledExpensify')}`;
}
return message;
};

const childContainer = (
Expand Down Expand Up @@ -200,7 +206,7 @@ function IOUPreview(props) {
<View style={[styles.flexRow]}>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={styles.textHeadline}>{CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency)}</Text>
{!props.iouReport.hasOutstandingIOU && !props.isBillSplit && (
{ReportUtils.isSettled(props.iouReport.reportID) && !props.isBillSplit && (
<View style={styles.defaultCheckmarkWrapper}>
<Icon
src={Expensicons.Checkmark}
Expand Down
6 changes: 2 additions & 4 deletions src/components/ReportActionItem/MoneyRequestAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import * as ReportActionsUtils from '../../libs/ReportActionsUtils';
import refPropTypes from '../refPropTypes';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
import reportPropTypes from '../../pages/reportPropTypes';

const propTypes = {
/** All the data of the action */
Expand All @@ -43,10 +44,7 @@ const propTypes = {

/* Onyx Props */
/** chatReport associated with iouReport */
chatReport: PropTypes.shape({
/** Whether the chat report has an outstanding IOU */
hasOutstandingIOU: PropTypes.bool.isRequired,
}),
chatReport: reportPropTypes,

/** IOU report data object */
iouReport: iouReportPropTypes,
Expand Down
30 changes: 24 additions & 6 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import _ from 'underscore';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -60,6 +61,9 @@ const propTypes = {

/** Does the iouReport have an outstanding IOU? */
hasOutstandingIOU: PropTypes.bool,

/** Is the iouReport waiting for the submitter to add a credit bank account? */
isWaitingOnBankAccount: PropTypes.bool,
}),

/** Session info for the currently logged in user. */
Expand Down Expand Up @@ -89,11 +93,27 @@ const defaultProps = {
};

function ReportPreview(props) {
const managerID = props.iouReport.managerID || 0;
const managerID = props.iouReport.managerID || props.action.actorAccountID || 0;
const isCurrentUserManager = managerID === lodashGet(props.session, 'accountID');
const reportAmount = CurrencyUtils.convertToDisplayString(ReportUtils.getMoneyRequestTotal(props.iouReport), props.iouReport.currency);
let reportAmount = ReportUtils.getMoneyRequestTotal(props.iouReport);
if (reportAmount) {
reportAmount = CurrencyUtils.convertToDisplayString(reportAmount, props.iouReport.currency);
} else {
// If iouReport is not available, get amount from the action message (Ex: "Domain20821's Workspace owes $33.00" or "paid ₫60" or "paid -₫60 elsewhere")
reportAmount = '';
const actionMessage = lodashGet(props.action, ['message', 0, 'text'], '');
const splits = actionMessage.split(' ');
for (let i = 0; i < splits.length; i++) {
if (/\d/.test(splits[i])) {
reportAmount = splits[i];
}
}
Comment on lines +106 to +110
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the user adds a number in the comment? That'd replace the amount, wouldn't it? I think we could achieve the same result without the for loop, by using the first match in this regex instead:

\S+\d[\d,\.]*?\b

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think the message in the preview action contains any user comment - And if you see the 3 examples the previous comment, this wouldn't work:

'Domain20821\'s Workspace owes $33.00'.match(/\S+\d[\d,\.]*?\b/)
['Domain20821', index: 0, input: "Domain20821's Workspace owes $33.00", groups: undefined]

Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like a temporary solution for sure, its probably quite brittle with different workspace names and also different currencies, I think we need to ensure any report preview which is shown to the user has the associated iou report loaded in the app. But that can be a polish

}

const managerName = ReportUtils.isPolicyExpenseChat(props.chatReport) ? ReportUtils.getPolicyName(props.chatReport) : ReportUtils.getDisplayNameForParticipant(managerID, true);
const bankAccountRoute = ReportUtils.getBankAccountRoute(props.chatReport);
const previewMessage = props.translate(ReportUtils.isSettled(props.iouReportID) || props.iouReport.isWaitingOnBankAccount ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName});

return (
<View style={[styles.chatItemMessage, ...props.containerStyles]}>
<PressableWithoutFeedback
Expand All @@ -110,9 +130,7 @@ function ReportPreview(props) {
<View style={[styles.iouPreviewBox, props.isHovered ? styles.iouPreviewBoxHover : undefined]}>
<View style={styles.flexRow}>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.textLabelSupporting, styles.mb1, styles.lh16]}>
{props.translate(ReportUtils.isSettled(props.iouReportID) ? 'iou.payerPaid' : 'iou.payerOwes', {payer: managerName})}
</Text>
<Text style={[styles.textLabelSupporting, styles.mb1, styles.lh16]}>{previewMessage}</Text>
</View>
</View>
<View style={styles.flexRow}>
Expand All @@ -128,7 +146,7 @@ function ReportPreview(props) {
)}
</View>
</View>
{isCurrentUserManager && !ReportUtils.isSettled(props.iouReport.reportID) && (
{!_.isEmpty(props.iouReport) && isCurrentUserManager && !ReportUtils.isSettled(props.iouReportID) && !props.iouReport.isWaitingOnBankAccount && (
<SettlementButton
currency={props.iouReport.currency}
policyID={props.iouReport.policyID}
Expand Down
3 changes: 3 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export default {
sendMoney: 'Send money',
pay: 'Pay',
viewDetails: 'View details',
pending: 'Pending',
settledExpensify: 'Paid',
settledElsewhere: 'Paid elsewhere',
settledPaypalMe: 'Paid using Paypal.me',
Expand All @@ -365,6 +366,8 @@ export default {
payerPaidAmount: ({payer, amount}) => `${payer} paid ${amount}`,
payerPaid: ({payer}) => `${payer} paid: `,
payerSettled: ({amount}) => `paid ${amount}`,
waitingOnBankAccount: ({submitterDisplayName}) => `started settling up, payment is held until ${submitterDisplayName} adds a bank account`,
settledAfterAddedBankAccount: ({submitterDisplayName, amount}) => `${submitterDisplayName} added a bank account. The ${amount} payment has been made.`,
paidElsewhereWithAmount: ({amount}) => `paid ${amount} elsewhere`,
paidUsingPaypalWithAmount: ({amount}) => `paid ${amount} using Paypal.me`,
paidUsingExpensifyWithAmount: ({amount}) => `paid ${amount} using Expensify`,
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ export default {
sendMoney: 'Enviar dinero',
pay: 'Pagar',
viewDetails: 'Ver detalles',
pending: 'Pendiente',
settledExpensify: 'Pagado',
settledElsewhere: 'Pagado de otra forma',
settledPaypalMe: 'Pagado con PayPal.me',
Expand All @@ -364,6 +365,8 @@ export default {
payerPaidAmount: ({payer, amount}) => `${payer} pagó ${amount}`,
payerPaid: ({payer}) => `${payer} pagó: `,
payerSettled: ({amount}) => `pagó ${amount}`,
waitingOnBankAccount: ({submitterDisplayName}) => `inicio el pago, pero no se procesará hasta que ${submitterDisplayName} agregue una Cuenta bancaria`,
settledAfterAddedBankAccount: ({submitterDisplayName, amount}) => `${submitterDisplayName} agregó una cuenta bancaria. El pago de ${amount} se ha realizado.`,
paidElsewhereWithAmount: ({amount}) => `pagó ${amount} de otra forma`,
paidUsingPaypalWithAmount: ({amount}) => `pagó ${amount} con PayPal.me`,
paidUsingExpensifyWithAmount: ({amount}) => `pagó ${amount} con Expensify`,
Expand Down
33 changes: 10 additions & 23 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,6 @@ Onyx.connect({
},
});

const expenseReports = {};
const iouReports = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
callback: (report, key) => {
if (!report || !key || !_.isNumber(report.ownerAccountID)) {
return;
}

if (ReportUtils.isExpenseReport(report)) {
expenseReports[key] = report;
return;
}

if (ReportUtils.isIOUReport(report)) {
iouReports[key] = report;
}
},
});

const lastReportActions = {};
const allSortedReportActions = {};
Onyx.connect({
Expand Down Expand Up @@ -455,6 +435,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
isDefaultRoom: false,
isPinned: false,
hasOutstandingIOU: false,
isWaitingOnBankAccount: false,
iouReportID: null,
isIOUReportOwner: null,
iouReportAmount: 0,
Expand Down Expand Up @@ -496,6 +477,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
result.keyForList = String(report.reportID);
result.tooltipText = ReportUtils.getReportParticipantsTitle(report.participantAccountIDs || []);
result.hasOutstandingIOU = report.hasOutstandingIOU;
result.isWaitingOnBankAccount = report.isWaitingOnBankAccount;

hasMultipleParticipants = personalDetailList.length > 1 || result.isChatRoom || result.isPolicyExpenseChat;
subtitle = ReportUtils.getChatRoomSubtitle(report);
Expand Down Expand Up @@ -531,8 +513,8 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
result.alternateText = LocalePhoneNumber.formatPhoneNumber(lodashGet(personalDetails, [accountIDs[0], 'login'], ''));
}

result.isIOUReportOwner = ReportUtils.isIOUOwnedByCurrentUser(result, iouReports);
result.iouReportAmount = ReportUtils.getMoneyRequestTotal(result, iouReports);
result.isIOUReportOwner = ReportUtils.isIOUOwnedByCurrentUser(result);
result.iouReportAmount = ReportUtils.getMoneyRequestTotal(result);

if (!hasMultipleParticipants) {
result.login = personalDetail.login;
Expand Down Expand Up @@ -652,7 +634,7 @@ function getOptions(
const searchValue = parsedPhoneNumber.possible ? parsedPhoneNumber.number.e164 : searchInputValue.toLowerCase();

// Filter out all the reports that shouldn't be displayed
const filteredReports = _.filter(reports, (report) => ReportUtils.shouldReportBeInOptionList(report, Navigation.getTopmostReportId(), false, iouReports, betas, policies));
const filteredReports = _.filter(reports, (report) => ReportUtils.shouldReportBeInOptionList(report, Navigation.getTopmostReportId(), false, null, betas, policies));

// Sorting the reports works like this:
// - Order everything by the last message timestamp (descending)
Expand Down Expand Up @@ -695,6 +677,11 @@ function getOptions(
return;
}

// In case user needs to add credit bank account, don't allow them to request more money from the workspace.
if (includeOwnedWorkspaceChats && ReportUtils.hasIOUWaitingOnCurrentUserBankAccount(report)) {
return;
}

// Save the report in the map if this is a single participant so we can associate the reportID with the
// personal detail option later. Individuals should not be associated with single participant
// policyExpenseChats or chatRooms since those are not people.
Expand Down
Loading
Loading