diff --git a/src/components/ReportActionItem/MoneyRequestAction.js b/src/components/ReportActionItem/MoneyRequestAction.js index 57c1934be23d..040682990d2c 100644 --- a/src/components/ReportActionItem/MoneyRequestAction.js +++ b/src/components/ReportActionItem/MoneyRequestAction.js @@ -122,7 +122,7 @@ function MoneyRequestAction({ if ( !_.isEmpty(iouReport) && !_.isEmpty(reportActions) && - chatReport.hasOutstandingIOU && + chatReport.iouReportID && isMostRecentIOUReportAction && action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD && network.isOffline diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js index 8dcdb32e530a..54eee7a8cc13 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview.js +++ b/src/components/ReportActionItem/MoneyRequestPreview.js @@ -77,9 +77,6 @@ const propTypes = { /** Currency of outstanding amount of this transaction */ currency: PropTypes.string, - - /** Does the iouReport have an outstanding IOU? */ - hasOutstandingIOU: PropTypes.bool, }), /** True if this is this IOU is a split instead of a 1:1 request */ diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js index 615e91dc5fc4..0eb0e9bd262b 100644 --- a/src/components/ReportActionItem/ReportPreview.js +++ b/src/components/ReportActionItem/ReportPreview.js @@ -69,9 +69,6 @@ const propTypes = { /** Currency of outstanding amount of this transaction */ currency: PropTypes.string, - /** 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, }), diff --git a/src/components/optionPropTypes.js b/src/components/optionPropTypes.js index d5ef485b8276..4cfadea33d60 100644 --- a/src/components/optionPropTypes.js +++ b/src/components/optionPropTypes.js @@ -40,9 +40,6 @@ export default PropTypes.shape({ // Whether the report corresponds to a chat room isChatRoom: PropTypes.bool, - // Whether the option has an outstanding IOU - hasOutstandingIOU: PropTypes.bool, - // Custom icon to render on the right side of the option customIcon: PropTypes.shape({ // The icon source diff --git a/src/libs/E2E/apiMocks/openApp.ts b/src/libs/E2E/apiMocks/openApp.ts index a0583d8439c0..42d13716407d 100644 --- a/src/libs/E2E/apiMocks/openApp.ts +++ b/src/libs/E2E/apiMocks/openApp.ts @@ -1527,7 +1527,6 @@ const openApp = (): Response => ({ 'applause.expensifail.com@expensify.cash. Learn more ' + 'here.' + ' For questions, just reply to this message.', - hasOutstandingIOU: false, }, report_98258458: { reportID: '98258458', @@ -1549,7 +1548,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: true, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_98344717: { reportID: '98344717', @@ -1571,7 +1569,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Requested \u20b41.67 from applausetester+perf2@applause.expensifail.com', - hasOutstandingIOU: false, }, report_98345050: { reportID: '98345050', @@ -1593,7 +1590,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Cancelled the \u20b440.00 request', - hasOutstandingIOU: false, }, report_98345315: { reportID: '98345315', @@ -1615,7 +1611,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'applausetester+perf2@applause.expensifail.com', - hasOutstandingIOU: false, }, report_98345625: { reportID: '98345625', @@ -1637,7 +1632,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Say hello\ud83d\ude10', - hasOutstandingIOU: false, }, report_98345679: { reportID: '98345679', @@ -1659,7 +1653,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: true, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_98414813: { reportID: '98414813', @@ -1681,7 +1674,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Split \u20b45.00 with applausetester+perf2@applause.expensifail.com and fake6@gmail.com', - hasOutstandingIOU: false, }, report_98817646: { reportID: '98817646', @@ -1703,7 +1695,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'RR', - hasOutstandingIOU: true, iouReportID: '2543745284790730', }, report_358751490033727: { @@ -1726,7 +1717,6 @@ const openApp = (): Response => ({ visibility: 'restricted', isOwnPolicyExpenseChat: false, lastMessageHtml: 'STAGING_CHAT_MESSAGE_A2C534B7-3509-416E-A0AD-8463831C29DD', - hasOutstandingIOU: false, }, report_663424408122117: { reportID: '663424408122117', @@ -1748,7 +1738,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_944123936554214: { reportID: '944123936554214', @@ -1770,7 +1759,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: true, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_2242399088152511: { reportID: '2242399088152511', @@ -1792,7 +1780,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: '

Hi there, thanks for reaching out! How may I help?

', - hasOutstandingIOU: false, }, report_2576922422943214: { reportID: '2576922422943214', @@ -1814,7 +1801,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Test', - hasOutstandingIOU: false, }, report_2752461403207161: { reportID: '2752461403207161', @@ -1836,7 +1822,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_3785654888638968: { reportID: '3785654888638968', @@ -1858,7 +1843,6 @@ const openApp = (): Response => ({ visibility: 'restricted', isOwnPolicyExpenseChat: false, lastMessageHtml: 'Room renamed to #jack', - hasOutstandingIOU: false, }, report_4867098979334014: { reportID: '4867098979334014', @@ -1880,7 +1864,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Requested \u20ac200.00 from Christoph for Essen mit Kunden', - hasOutstandingIOU: true, iouReportID: '4249286573496381', }, report_5277760851229035: { @@ -1905,7 +1888,6 @@ const openApp = (): Response => ({ lastMessageHtml: 'fff
f
f
f
f
f
f
f
f

f
f
f
f

f
' + 'f
f
f
f
f

f
f
f
f
f
ff', - hasOutstandingIOU: false, }, report_5324367938904284: { reportID: '5324367938904284', @@ -1927,7 +1909,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Iviviviv8b', - hasOutstandingIOU: false, }, report_5654270288238256: { reportID: '5654270288238256', @@ -1949,7 +1930,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_6194900075541844: { reportID: '6194900075541844', @@ -1971,7 +1951,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_6801643744224146: { reportID: '6801643744224146', @@ -1994,7 +1973,6 @@ const openApp = (): Response => ({ isOwnPolicyExpenseChat: false, lastMessageHtml: "\ud83d\udc4b Welcome to Expensify! I'm Concierge. Is there anything I can help with? Click the + icon on the homescreen to explore the features you can use.", - hasOutstandingIOU: false, }, report_7658708888047100: { reportID: '7658708888047100', @@ -2016,7 +1994,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: 'Hi there! How can I help?\u00a0', - hasOutstandingIOU: false, }, report_7756405299640824: { reportID: '7756405299640824', @@ -2038,7 +2015,6 @@ const openApp = (): Response => ({ visibility: 'restricted', isOwnPolicyExpenseChat: false, lastMessageHtml: 'Room renamed to #jackd23', - hasOutstandingIOU: false, }, report_7819732651025410: { reportID: '7819732651025410', @@ -2060,7 +2036,6 @@ const openApp = (): Response => ({ visibility: null, isOwnPolicyExpenseChat: false, lastMessageHtml: '', - hasOutstandingIOU: false, }, report_2543745284790730: { reportID: '2543745284790730', @@ -2072,7 +2047,6 @@ const openApp = (): Response => ({ cachedTotal: '($1,473.11)', total: 147311, stateNum: 1, - hasOutstandingIOU: true, }, report_4249286573496381: { reportID: '4249286573496381', @@ -2084,7 +2058,6 @@ const openApp = (): Response => ({ cachedTotal: '($212.78)', total: 21278, stateNum: 1, - hasOutstandingIOU: true, }, }, }, diff --git a/src/libs/E2E/apiMocks/openReport.ts b/src/libs/E2E/apiMocks/openReport.ts index 1d0b5a4c54ac..eb5df2394e11 100644 --- a/src/libs/E2E/apiMocks/openReport.ts +++ b/src/libs/E2E/apiMocks/openReport.ts @@ -32,7 +32,6 @@ export default (): Response => ({ isOwnPolicyExpenseChat: false, lastMessageHtml: 'terry+hightraffic@margelo.io owes \u20ac12.00', iouReportID: '206636935813547', - hasOutstandingIOU: false, hasOutstandingChildRequest: false, policyName: null, hasParentAccess: null, diff --git a/src/libs/IOUUtils.ts b/src/libs/IOUUtils.ts index 543dbf9779a3..edfb9e3691d0 100644 --- a/src/libs/IOUUtils.ts +++ b/src/libs/IOUUtils.ts @@ -95,8 +95,6 @@ function updateIOUOwnerAndTotal(iouReport: OnyxEntry, actorAccountID: nu iouReportUpdate.managerID = iouReport.ownerAccountID; iouReportUpdate.total = -iouReportUpdate.total; } - - iouReportUpdate.hasOutstandingIOU = iouReportUpdate.total !== 0; } return iouReportUpdate; diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 514271a56280..95a8c52649d3 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -456,7 +456,6 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, { searchText: null, isDefaultRoom: false, isPinned: false, - hasOutstandingIOU: false, isWaitingOnBankAccount: false, iouReportID: null, isIOUReportOwner: null, @@ -503,7 +502,6 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, { result.iouReportID = report.iouReportID; result.keyForList = String(report.reportID); result.tooltipText = ReportUtils.getReportParticipantsTitle(report.participantAccountIDs || []); - result.hasOutstandingIOU = report.hasOutstandingIOU; result.isWaitingOnBankAccount = report.isWaitingOnBankAccount; result.policyID = report.policyID; diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9e51d35fb253..6a59d39ce9e4 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -107,7 +107,6 @@ type OptimisticExpenseReport = Pick< | 'policyID' | 'type' | 'ownerAccountID' - | 'hasOutstandingIOU' | 'currency' | 'reportName' | 'state' @@ -197,7 +196,6 @@ type OptimisticChatReport = Pick< Report, | 'type' | 'chatType' - | 'hasOutstandingIOU' | 'isOwnPolicyExpenseChat' | 'isPinned' | 'lastActorAccountID' @@ -297,7 +295,6 @@ type TransactionDetails = type OptimisticIOUReport = Pick< Report, | 'cachedTotal' - | 'hasOutstandingIOU' | 'type' | 'chatReportID' | 'currency' @@ -751,6 +748,13 @@ function isConciergeChatReport(report: OnyxEntry): boolean { return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report); } +/** + * Returns true if report is still being processed + */ +function isProcessingReport(report: OnyxEntry): boolean { + return report?.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && report?.statusNum === CONST.REPORT.STATUS.SUBMITTED; +} + /** * Check if the report is a single chat report that isn't a thread * and personal detail of participant is optimistic data @@ -1612,7 +1616,7 @@ function getMoneyRequestReimbursableTotal(report: OnyxEntry, allReportsD if (isMoneyRequestReport(report)) { moneyRequestReport = report; } - if (allAvailableReports && report?.hasOutstandingIOU && report?.iouReportID) { + if (allAvailableReports && report?.iouReportID) { moneyRequestReport = allAvailableReports[`${ONYXKEYS.COLLECTION.REPORT}${report.iouReportID}`]; } if (moneyRequestReport) { @@ -1634,7 +1638,7 @@ function getMoneyRequestSpendBreakdown(report: OnyxEntry, allReportsDict if (isMoneyRequestReport(report)) { moneyRequestReport = report; } - if (allAvailableReports && report?.hasOutstandingIOU && report?.iouReportID) { + if (allAvailableReports && report?.iouReportID) { moneyRequestReport = allAvailableReports[`${ONYXKEYS.COLLECTION.REPORT}${report.iouReportID}`]; } if (moneyRequestReport) { @@ -1728,7 +1732,7 @@ function getMoneyRequestReportName(report: OnyxEntry, policy: OnyxEntry< return Localize.translateLocal('iou.payerSpentAmount', {payer: payerName, amount: formattedAmount}); } - if (!!report?.hasOutstandingIOU || isDraftExpenseReport(report) || moneyRequestTotal === 0) { + if (isProcessingReport(report) || isDraftExpenseReport(report) || moneyRequestTotal === 0) { return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount}); } @@ -2553,8 +2557,6 @@ function buildOptimisticIOUReport(payeeAccountID: number, payerAccountID: number const personalDetails = getPersonalDetailsForAccountID(payerAccountID); const payerEmail = 'login' in personalDetails ? personalDetails.login : ''; return { - // If we're sending money, hasOutstandingIOU should be false - hasOutstandingIOU: !isSendingMoney, type: CONST.REPORT.TYPE.IOU, cachedTotal: formattedTotal, chatReportID, @@ -2608,7 +2610,6 @@ function buildOptimisticExpenseReport(chatReportID: string, policyID: string, pa policyID, type: CONST.REPORT.TYPE.EXPENSE, ownerAccountID: payeeAccountID, - hasOutstandingIOU: true, currency: outputCurrency, // We don't translate reportName because the server response is always in English @@ -3087,7 +3088,6 @@ function buildOptimisticChatReport( return { type: CONST.REPORT.TYPE.CHAT, chatType, - hasOutstandingIOU: false, isOwnPolicyExpenseChat, isPinned: reportName === CONST.REPORT.WORKSPACE_CHAT_ROOMS.ADMINS || isNewlyCreatedWorkspaceChat, lastActorAccountID: 0, @@ -4346,6 +4346,7 @@ export { isPublicRoom, isPublicAnnounceRoom, isConciergeChatReport, + isProcessingReport, isCurrentUserTheOnlyParticipant, hasAutomatedExpensifyAccountIDs, hasExpensifyGuidesEmails, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 1da1469a2687..af80265a57e9 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -260,7 +260,6 @@ function getOptionData( keyForList: null, searchText: null, isPinned: false, - hasOutstandingIOU: false, hasOutstandingChildRequest: false, isIOUReportOwner: null, iouReportAmount: 0, @@ -301,7 +300,6 @@ function getOptionData( result.iouReportID = report.iouReportID; result.keyForList = String(report.reportID); result.tooltipText = ReportUtils.getReportParticipantsTitle(report.participantAccountIDs ?? []); - result.hasOutstandingIOU = report.hasOutstandingIOU; result.hasOutstandingChildRequest = report.hasOutstandingChildRequest; result.parentReportID = report.parentReportID ?? ''; result.isWaitingOnBankAccount = report.isWaitingOnBankAccount; diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 744f3f4c575b..c65b56313a2d 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -264,7 +264,6 @@ function buildOnyxDataForMoneyRequest( ...chatReport, lastReadTime: DateUtils.getDBTime(), lastMessageTranslationKey: '', - hasOutstandingIOU: iouReport.total !== 0, iouReportID: iouReport.reportID, ...(isNewChatReport ? {pendingFields: {createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}} : {}), }, @@ -409,7 +408,6 @@ function buildOnyxDataForMoneyRequest( onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, value: { - hasOutstandingIOU: chatReport.hasOutstandingIOU, iouReportID: chatReport.iouReportID, lastReadTime: chatReport.lastReadTime, pendingFields: null, @@ -2259,7 +2257,6 @@ function deleteMoneyRequest(transactionID, reportAction, isSingleTransactionView onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, value: { - hasOutstandingIOU: false, hasOutstandingChildRequest: false, iouReportID: null, lastMessageText: ReportActionsUtils.getLastVisibleMessage(iouReport.chatReportID, {[reportPreviewAction.reportActionID]: null}).lastMessageText, @@ -2604,7 +2601,6 @@ function getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentMetho ...chatReport, lastReadTime: DateUtils.getDBTime(), lastVisibleActionCreated: optimisticIOUReportAction.created, - hasOutstandingIOU: false, hasOutstandingChildRequest: false, iouReportID: null, lastMessageText: optimisticIOUReportAction.message[0].text, @@ -2628,7 +2624,6 @@ function getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentMetho ...iouReport, lastMessageText: optimisticIOUReportAction.message[0].text, lastMessageHtml: optimisticIOUReportAction.message[0].html, - hasOutstandingIOU: false, hasOutstandingChildRequest: false, statusNum: CONST.REPORT.STATUS.REIMBURSED, }, @@ -2823,7 +2818,6 @@ function submitReport(expenseReport) { key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport.reportID}`, value: { ...parentReport, - hasOutstandingIOU: false, hasOutstandingChildRequest: false, iouReportID: null, }, @@ -2868,7 +2862,6 @@ function submitReport(expenseReport) { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport.reportID}`, value: { - hasOutstandingIOU: parentReport.hasOutstandingIOU, hasOutstandingChildRequest: parentReport.hasOutstandingChildRequest, iouReportID: expenseReport.reportID, }, diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 8db899a8f73f..50d6531096fc 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -99,9 +99,7 @@ const propTypes = { const defaultProps = { isSidebarLoaded: false, reportActions: [], - report: { - hasOutstandingIOU: false, - }, + report: {}, reportMetadata: { isLoadingInitialReportActions: true, isLoadingOlderReportActions: false, diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index e172627d04ef..3e4eebffe48f 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -103,10 +103,6 @@ const propTypes = { /** Draft message - if this is set the comment is in 'edit' mode */ draftMessage: PropTypes.string, - /* Whether the option has an outstanding IOU */ - // eslint-disable-next-line react/no-unused-prop-types - hasOutstandingIOU: PropTypes.bool, - /** Stores user's preferred skin tone */ preferredSkinTone: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), @@ -128,7 +124,6 @@ const defaultProps = { preferredSkinTone: CONST.EMOJI_DEFAULT_SKIN_TONE, emojiReactions: {}, shouldShowSubscriptAvatar: false, - hasOutstandingIOU: false, iouReport: undefined, shouldHideThreadDividerLine: false, userWallet: {}, @@ -788,7 +783,6 @@ export default compose( prevProps.displayAsGroup === nextProps.displayAsGroup && prevProps.draftMessage === nextProps.draftMessage && prevProps.isMostRecentIOUReportAction === nextProps.isMostRecentIOUReportAction && - prevProps.hasOutstandingIOU === nextProps.hasOutstandingIOU && prevProps.shouldDisplayNewMarker === nextProps.shouldDisplayNewMarker && _.isEqual(prevProps.emojiReactions, nextProps.emojiReactions) && _.isEqual(prevProps.action, nextProps.action) && diff --git a/src/pages/home/report/ReportActionsList.js b/src/pages/home/report/ReportActionsList.js index 183665891929..55995a8059e7 100644 --- a/src/pages/home/report/ReportActionsList.js +++ b/src/pages/home/report/ReportActionsList.js @@ -131,7 +131,6 @@ function ReportActionsList({ isSmallScreenWidth, personalDetailsList, currentUserPersonalDetails, - hasOutstandingIOU, loadNewerChats, loadOlderChats, onLayout, @@ -383,14 +382,13 @@ function ReportActionsList({ index={index} report={report} linkedReportActionID={linkedReportActionID} - hasOutstandingIOU={hasOutstandingIOU} sortedReportActions={sortedReportActions} mostRecentIOUReportActionID={mostRecentIOUReportActionID} shouldHideThreadDividerLine={shouldHideThreadDividerLine} shouldDisplayNewMarker={shouldDisplayNewMarker(reportAction, index)} /> ), - [report, linkedReportActionID, hasOutstandingIOU, sortedReportActions, mostRecentIOUReportActionID, shouldHideThreadDividerLine, shouldDisplayNewMarker], + [report, linkedReportActionID, sortedReportActions, mostRecentIOUReportActionID, shouldHideThreadDividerLine, shouldDisplayNewMarker], ); // Native mobile does not render updates flatlist the changes even though component did update called. diff --git a/src/pages/home/report/ReportActionsListItemRenderer.js b/src/pages/home/report/ReportActionsListItemRenderer.js index 0273a3f31805..516053d1fe6a 100644 --- a/src/pages/home/report/ReportActionsListItemRenderer.js +++ b/src/pages/home/report/ReportActionsListItemRenderer.js @@ -19,9 +19,6 @@ const propTypes = { /** Report for this action */ report: reportPropTypes.isRequired, - /** Whether the option has an outstanding IOU */ - hasOutstandingIOU: PropTypes.bool, - /** Sorted actions prepared for display */ sortedReportActions: PropTypes.arrayOf(PropTypes.shape(reportActionPropTypes)).isRequired, @@ -40,7 +37,6 @@ const propTypes = { const defaultProps = { mostRecentIOUReportActionID: '', - hasOutstandingIOU: false, linkedReportActionID: '', }; @@ -48,7 +44,6 @@ function ReportActionsListItemRenderer({ reportAction, index, report, - hasOutstandingIOU, sortedReportActions, mostRecentIOUReportActionID, shouldHideThreadDividerLine, @@ -80,7 +75,6 @@ function ReportActionsListItemRenderer({ _.contains([CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW], reportAction.actionName) } isMostRecentIOUReportAction={reportAction.reportActionID === mostRecentIOUReportActionID} - hasOutstandingIOU={hasOutstandingIOU} index={index} /> ); diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index e7b293babdf5..2758437a3962 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -315,10 +315,6 @@ function arePropsEqual(oldProps, newProps) { return false; } - if (lodashGet(newProps.report, 'hasOutstandingIOU') !== lodashGet(oldProps.report, 'hasOutstandingIOU')) { - return false; - } - if (newProps.isComposerFullSize !== oldProps.isComposerFullSize) { return false; } diff --git a/src/pages/home/sidebar/SidebarLinksData.js b/src/pages/home/sidebar/SidebarLinksData.js index 4f55d5eafca9..97f119bbd2e8 100644 --- a/src/pages/home/sidebar/SidebarLinksData.js +++ b/src/pages/home/sidebar/SidebarLinksData.js @@ -148,7 +148,6 @@ const chatReportSelector = (report) => iouReportID: report.iouReportID, total: report.total, nonReimbursableTotal: report.nonReimbursableTotal, - hasOutstandingIOU: report.hasOutstandingIOU, hasOutstandingChildRequest: report.hasOutstandingChildRequest, isWaitingOnBankAccount: report.isWaitingOnBankAccount, statusNum: report.statusNum, diff --git a/src/pages/reportPropTypes.js b/src/pages/reportPropTypes.js index a3bbbda5c0bf..c89ea761f582 100644 --- a/src/pages/reportPropTypes.js +++ b/src/pages/reportPropTypes.js @@ -7,9 +7,6 @@ export default PropTypes.shape({ /** The specific type of chat */ chatType: PropTypes.oneOf(['', ..._.values(CONST.REPORT.CHAT_TYPE)]), - /** Whether there is an outstanding amount in IOU */ - hasOutstandingIOU: PropTypes.bool, - /** List of icons for report participants */ icons: PropTypes.arrayOf(avatarPropTypes), diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index a077bf1a3281..5016bc1ba2d8 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -7,9 +7,6 @@ type Report = { /** The specific type of chat */ chatType?: ValueOf; - /** Whether there is an outstanding amount in IOU */ - hasOutstandingIOU?: boolean; - /** Whether the report has a child that is an outstanding money request that is awaiting action from the current user */ hasOutstandingChildRequest?: boolean; diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 18793e88d624..97c1bf35732f 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -83,7 +83,6 @@ describe('actions/IOU', () => { // They should be linked together expect(chatReport.participantAccountIDs).toEqual([CARLOS_ACCOUNT_ID]); expect(chatReport.iouReportID).toBe(iouReport.reportID); - expect(chatReport.hasOutstandingIOU).toBe(true); resolve(); }, @@ -206,7 +205,6 @@ describe('actions/IOU', () => { let chatReport = { reportID: 1234, type: CONST.REPORT.TYPE.CHAT, - hasOutstandingIOU: false, participantAccountIDs: [CARLOS_ACCOUNT_ID], }; const createdAction = { @@ -249,7 +247,6 @@ describe('actions/IOU', () => { // They should be linked together expect(chatReport.iouReportID).toBe(iouReportID); - expect(chatReport.hasOutstandingIOU).toBe(true); resolve(); }, @@ -370,7 +367,6 @@ describe('actions/IOU', () => { let chatReport = { reportID: chatReportID, type: CONST.REPORT.TYPE.CHAT, - hasOutstandingIOU: true, iouReportID, participantAccountIDs: [CARLOS_ACCOUNT_ID], }; @@ -581,7 +577,6 @@ describe('actions/IOU', () => { // They should be linked together expect(chatReport.participantAccountIDs).toEqual([CARLOS_ACCOUNT_ID]); expect(chatReport.iouReportID).toBe(iouReport.reportID); - expect(chatReport.hasOutstandingIOU).toBe(true); resolve(); }, @@ -815,7 +810,6 @@ describe('actions/IOU', () => { let carlosChatReport = { reportID: NumberUtils.rand64(), type: CONST.REPORT.TYPE.CHAT, - hasOutstandingIOU: false, participantAccountIDs: [CARLOS_ACCOUNT_ID], }; const carlosCreatedAction = { @@ -827,7 +821,6 @@ describe('actions/IOU', () => { let julesChatReport = { reportID: NumberUtils.rand64(), type: CONST.REPORT.TYPE.CHAT, - hasOutstandingIOU: true, iouReportID: julesIOUReportID, participantAccountIDs: [JULES_ACCOUNT_ID], }; @@ -985,16 +978,13 @@ describe('actions/IOU', () => { expect(groupChat.pendingFields).toStrictEqual({createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}); // The 1:1 chat reports and the IOU reports should be linked together - expect(carlosChatReport.hasOutstandingIOU).toBe(true); expect(carlosChatReport.iouReportID).toBe(carlosIOUReport.reportID); expect(carlosIOUReport.chatReportID).toBe(carlosChatReport.reportID); expect(carlosIOUReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); - expect(julesChatReport.hasOutstandingIOU).toBe(true); expect(julesChatReport.iouReportID).toBe(julesIOUReport.reportID); expect(julesIOUReport.chatReportID).toBe(julesChatReport.reportID); - expect(vitChatReport.hasOutstandingIOU).toBe(true); expect(vitChatReport.iouReportID).toBe(vitIOUReport.reportID); expect(vitIOUReport.chatReportID).toBe(vitChatReport.reportID); expect(carlosIOUReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); @@ -1233,7 +1223,6 @@ describe('actions/IOU', () => { expect(chatReport).toBeTruthy(); expect(chatReport).toHaveProperty('reportID'); expect(chatReport).toHaveProperty('iouReportID'); - expect(chatReport.hasOutstandingIOU).toBe(true); iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); expect(iouReport).toBeTruthy(); @@ -1313,7 +1302,6 @@ describe('actions/IOU', () => { chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT); iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU); - expect(chatReport.hasOutstandingIOU).toBe(false); expect(chatReport.iouReportID).toBeFalsy(); // expect(iouReport.status).toBe(CONST.REPORT.STATUS.REIMBURSED); @@ -1364,7 +1352,6 @@ describe('actions/IOU', () => { chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT); iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU); - expect(chatReport.hasOutstandingIOU).toBe(false); expect(chatReport.iouReportID).toBeFalsy(); // expect(iouReport.status).toBe(CONST.REPORT.STATUS.REIMBURSED); @@ -1925,7 +1912,6 @@ describe('actions/IOU', () => { expect(chatReport).toBeTruthy(); expect(chatReport).toHaveProperty('reportID'); expect(chatReport).toHaveProperty('iouReportID'); - expect(chatReport.hasOutstandingIOU).toBe(true); // Then one of them should be an IOU report with relevant properties iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); @@ -2492,7 +2478,6 @@ describe('actions/IOU', () => { expect(iouReport).toBeTruthy(); expect(iouReport).toHaveProperty('reportID'); expect(iouReport).toHaveProperty('chatReportID'); - expect(iouReport.hasOutstandingIOU).toBeTruthy(); expect(iouReport.total).toBe(30000); const ioupreview = ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); @@ -2510,7 +2495,6 @@ describe('actions/IOU', () => { expect(iouReport).toBeTruthy(); expect(iouReport).toHaveProperty('reportID'); expect(iouReport).toHaveProperty('chatReportID'); - expect(iouReport.hasOutstandingIOU).toBeTruthy(); expect(iouReport.total).toBe(20000); // When we resume fetch @@ -2520,7 +2504,6 @@ describe('actions/IOU', () => { expect(iouReport).toBeTruthy(); expect(iouReport).toHaveProperty('reportID'); expect(iouReport).toHaveProperty('chatReportID'); - expect(iouReport.hasOutstandingIOU).toBeTruthy(); expect(iouReport.total).toBe(20000); }); diff --git a/tests/unit/OptionsListUtilsTest.js b/tests/unit/OptionsListUtilsTest.js index 2f4294e53c73..45ddf44b244a 100644 --- a/tests/unit/OptionsListUtilsTest.js +++ b/tests/unit/OptionsListUtilsTest.js @@ -99,7 +99,6 @@ describe('OptionsListUtils', () => { participantAccountIDs: [8], reportName: 'Mister Sinister', iouReportID: 100, - hasOutstandingIOU: true, type: CONST.REPORT.TYPE.CHAT, }, diff --git a/tests/unit/ReportUtilsTest.js b/tests/unit/ReportUtilsTest.js index e0c98b1793f1..d060adb4c072 100644 --- a/tests/unit/ReportUtilsTest.js +++ b/tests/unit/ReportUtilsTest.js @@ -254,7 +254,6 @@ describe('ReportUtils', () => { const report = { ...LHNTestUtils.getFakeReport(), ownerAccountID: undefined, - hasOutstandingIOU: true, }; expect(ReportUtils.requiresAttentionFromCurrentUser(report)).toBe(false); }); @@ -266,7 +265,6 @@ describe('ReportUtils', () => { Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}1`, { reportID: '1', ownerAccountID: 99, - hasOutstandingIOU: true, }).then(() => { expect(ReportUtils.requiresAttentionFromCurrentUser(report)).toBe(false); }); @@ -274,7 +272,6 @@ describe('ReportUtils', () => { it('returns false when the report has no outstanding IOU but is waiting for a bank account and the logged user is the report owner', () => { const report = { ...LHNTestUtils.getFakeReport(), - hasOutstandingIOU: false, ownerAccountID: currentUserAccountID, isWaitingOnBankAccount: true, }; @@ -283,7 +280,6 @@ describe('ReportUtils', () => { it('returns false when the report has outstanding IOU and is not waiting for a bank account and the logged user is the report owner', () => { const report = { ...LHNTestUtils.getFakeReport(), - hasOutstandingIOU: true, ownerAccountID: currentUserAccountID, isWaitingOnBankAccount: false, }; @@ -292,7 +288,6 @@ describe('ReportUtils', () => { it('returns false when the report has no oustanding IOU but is waiting for a bank account and the logged user is not the report owner', () => { const report = { ...LHNTestUtils.getFakeReport(), - hasOutstandingIOU: false, ownerAccountID: 97, isWaitingOnBankAccount: true, }; @@ -319,7 +314,6 @@ describe('ReportUtils', () => { const report = { ...LHNTestUtils.getFakeReport(), ownerAccountID: 99, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, isWaitingOnBankAccount: false, }; diff --git a/tests/unit/SidebarFilterTest.js b/tests/unit/SidebarFilterTest.js index e421e16e270f..dd2985ea34a8 100644 --- a/tests/unit/SidebarFilterTest.js +++ b/tests/unit/SidebarFilterTest.js @@ -295,8 +295,6 @@ describe('Sidebar', () => { // 4. isUnread // 5. isPinned // 6. hasDraft - // There is one setting not represented here, which is hasOutstandingIOU. In order to test that setting, there must be - // additional reports in Onyx, so it's being left out for now. It's identical to the logic for hasDraft and isPinned though. // Given these combinations of booleans which result in the report being filtered out (not shown). const booleansWhichRemovesActiveReport = [ @@ -620,8 +618,6 @@ describe('Sidebar', () => { // 4. isUnread // 5. isPinned // 6. hasDraft - // There is one setting not represented here, which is hasOutstandingIOU. In order to test that setting, there must be - // additional reports in Onyx, so it's being left out for now. It's identical to the logic for hasDraft and isPinned though. // Given these combinations of booleans which result in the report being filtered out (not shown). const booleansWhichRemovesActiveReport = [ diff --git a/tests/unit/SidebarOrderTest.js b/tests/unit/SidebarOrderTest.js index ecd2afc59a72..44d6dd57de91 100644 --- a/tests/unit/SidebarOrderTest.js +++ b/tests/unit/SidebarOrderTest.js @@ -309,11 +309,12 @@ describe('Sidebar', () => { type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 2, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 10000, currency: 'USD', chatReportID: report3.reportID, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; report3.iouReportID = iouReport.reportID; @@ -371,11 +372,11 @@ describe('Sidebar', () => { ownerAccountID: 7, managerID: 7, policyName: 'Workspace', - hasOutstandingIOU: true, total: -10000, currency: 'USD', state: CONST.REPORT.STATE.SUBMITTED, stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, chatReportID: report3.reportID, parentReportID: report3.reportID, }; @@ -570,11 +571,13 @@ describe('Sidebar', () => { type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 2, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 10000, currency: 'USD', chatReportID: report3.reportID, + state: CONST.REPORT.STATE.SUBMITTED, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; report3.iouReportID = iouReport.reportID; const currentReportId = report2.reportID; @@ -886,7 +889,6 @@ describe('Sidebar', () => { }; const report3 = { ...LHNTestUtils.getFakeReport([5, 6]), - hasOutstandingIOU: false, // This has to be added after the IOU report is generated iouReportID: null, @@ -908,55 +910,60 @@ describe('Sidebar', () => { type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 2, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 10000, currency: 'USD', chatReportID: report3.reportID, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; const iouReport2 = { ...LHNTestUtils.getFakeReport([9, 10]), type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 3, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 10000, currency: 'USD', chatReportID: report3.reportID, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; const iouReport3 = { ...LHNTestUtils.getFakeReport([11, 12]), type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 4, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 100000, currency: 'USD', chatReportID: report3.reportID, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; const iouReport4 = { ...LHNTestUtils.getFakeReport([11, 12]), type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 5, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 10000, currency: 'USD', chatReportID: report3.reportID, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; const iouReport5 = { ...LHNTestUtils.getFakeReport([11, 12]), type: CONST.REPORT.TYPE.IOU, ownerAccountID: 2, managerID: 6, - hasOutstandingIOU: true, hasOutstandingChildRequest: true, total: 10000, currency: 'USD', chatReportID: report3.reportID, + stateNum: CONST.REPORT.STATE_NUM.PROCESSING, + statusNum: CONST.REPORT.STATUS.SUBMITTED, }; report1.iouReportID = iouReport1.reportID; diff --git a/tests/utils/LHNTestUtils.js b/tests/utils/LHNTestUtils.js index 546853b8893b..8385b3fd3e4b 100644 --- a/tests/utils/LHNTestUtils.js +++ b/tests/utils/LHNTestUtils.js @@ -196,9 +196,6 @@ function getFakeReportAction(actor = 'email1@test.com', millisecondsInThePast = } /** - * There is one setting not represented here, which is hasOutstandingIOU. In order to test that setting, there must be - * additional reports in Onyx, so it's being left out for now. - * * @param {boolean} isArchived * @param {boolean} isUserCreatedPolicyRoom * @param {boolean} hasAddWorkspaceError