From 7315ae8bd8af2198a5060461bb0687e4ae88d419 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 29 Jan 2024 15:11:29 -0500 Subject: [PATCH 01/21] Add originalMessage to reportAction in reportActionsSelector for LHN --- src/pages/home/sidebar/SidebarLinksData.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/sidebar/SidebarLinksData.js b/src/pages/home/sidebar/SidebarLinksData.js index d64734a78085..6072395fde50 100644 --- a/src/pages/home/sidebar/SidebarLinksData.js +++ b/src/pages/home/sidebar/SidebarLinksData.js @@ -213,7 +213,7 @@ const chatReportSelector = (report) => const reportActionsSelector = (reportActions) => reportActions && lodashMap(reportActions, (reportAction) => { - const {reportActionID, parentReportActionID, actionName, errors = []} = reportAction; + const {reportActionID, parentReportActionID, actionName, errors = [], originalMessage} = reportAction; const decision = lodashGet(reportAction, 'message[0].moderationDecision.decision'); return { @@ -226,6 +226,7 @@ const reportActionsSelector = (reportActions) => moderationDecision: {decision}, }, ], + originalMessage, }; }); From 33da1f434bec083d6b19fc9ac9ba07ff2458c852 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 29 Jan 2024 15:39:32 -0500 Subject: [PATCH 02/21] Add optimistic transaction thread logic for iou functions --- src/libs/actions/IOU.js | 179 ++++++++++++++++++++++++++++++++++------ 1 file changed, 156 insertions(+), 23 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 3d6664099866..e01a7a1127c3 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -350,6 +350,8 @@ function getOutstandingChildRequest(policy, needsToBeManuallySubmitted) { * @param {Array} optimisticPolicyRecentlyUsedTags * @param {boolean} isNewChatReport * @param {boolean} isNewIOUReport + * @param {Object} transactionThreadReport + * @param {Object} transactionThreadCreatedReportAction * @param {Object} policy - May be undefined, an empty object, or an object matching the Policy type (src/types/onyx/Policy.ts) * @param {Array} policyTags * @param {Array} policyCategories @@ -369,6 +371,8 @@ function buildOnyxDataForMoneyRequest( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, + transactionThreadReport, + transactionThreadCreatedReportAction, policy, policyTags, policyCategories, @@ -423,6 +427,18 @@ function buildOnyxDataForMoneyRequest( [iouAction.reportActionID]: iouAction, }, }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport.reportID}`, + value: transactionThreadReport, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`, + value: { + [transactionThreadCreatedReportAction.reportActionID]: transactionThreadCreatedReportAction, + }, + }, // Remove the temporary transaction used during the creation flow { @@ -477,6 +493,14 @@ function buildOnyxDataForMoneyRequest( errorFields: null, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport.reportID}`, + value: { + pendingFields: null, + errorFields: null, + }, + }, { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, @@ -521,6 +545,16 @@ function buildOnyxDataForMoneyRequest( }, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`, + value: { + [transactionThreadCreatedReportAction.reportActionID]: { + pendingAction: null, + errors: null, + }, + }, + }, ]; const failureData = [ @@ -551,6 +585,15 @@ function buildOnyxDataForMoneyRequest( }, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport.reportID}`, + value: { + errorFields: { + createChat: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'), + }, + }, + }, { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, @@ -609,6 +652,15 @@ function buildOnyxDataForMoneyRequest( }), }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`, + value: { + [transactionThreadCreatedReportAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + }, + }, + }, ]; // Policy won't be set for P2P cases for which we don't need to compute violations @@ -661,6 +713,8 @@ function buildOnyxDataForMoneyRequest( * @returns {Object} data.createdIOUReportActionID * @returns {Object} data.reportPreviewAction * @returns {Object} data.onyxData + * @returns {Object} data.transactionThreadReportID + * @returns {Object} data.createdReportActionForThread * @returns {Object} data.onyxData.optimisticData * @returns {Object} data.onyxData.successData * @returns {Object} data.onyxData.failureData @@ -786,7 +840,8 @@ function getMoneyRequestInformation( // 1. CREATED action for the chatReport // 2. CREATED action for the iouReport // 3. IOU action for the iouReport - // 4. REPORTPREVIEW action for the chatReport + // 4. The transaction thread, which requires the iouAction, and CREATED action for the transaction thread + // 5. REPORTPREVIEW action for the chatReport // Note: The CREATED action for the IOU report must be optimistically generated before the IOU action so there's no chance that it appears after the IOU action in the chat const currentTime = DateUtils.getDBTime(); const optimisticCreatedActionForChat = ReportUtils.buildOptimisticCreatedReportAction(payeeEmail); @@ -806,6 +861,8 @@ function getMoneyRequestInformation( false, currentTime, ); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(iouAction, iouReport.reportID); + const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(payeeEmail); let reportPreviewAction = isNewIOUReport ? null : ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); if (reportPreviewAction) { @@ -846,6 +903,8 @@ function getMoneyRequestInformation( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, + optimisticTransactionThread, + optimisticCreatedActionForTransactionThread, policy, policyTags, policyCategories, @@ -862,6 +921,8 @@ function getMoneyRequestInformation( createdChatReportActionID: isNewChatReport ? optimisticCreatedActionForChat.reportActionID : 0, createdIOUReportActionID: isNewIOUReport ? optimisticCreatedActionForIOU.reportActionID : 0, reportPreviewAction, + transactionThreadReportID: optimisticTransactionThread.reportID, + createdReportActionIDForThread: optimisticCreatedActionForTransactionThread.reportActionID, onyxData: { optimisticData, successData, @@ -898,7 +959,18 @@ function createDistanceRequest(report, participant, comment, created, category, source: ReceiptGeneric, state: CONST.IOU.RECEIPT_STATE.OPEN, }; - const {iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation( + const { + iouReport, + chatReport, + transaction, + iouAction, + createdChatReportActionID, + createdIOUReportActionID, + reportPreviewAction, + transactionThreadReportID, + createdReportActionIDForThread, + onyxData, + } = getMoneyRequestInformation( currentChatReport, participant, comment, @@ -933,6 +1005,8 @@ function createDistanceRequest(report, participant, comment, created, category, category, tag, billable, + transactionThreadReportID, + createdReportActionIDForThread, }, onyxData, ); @@ -1314,26 +1388,38 @@ function requestMoney( const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report.chatReportID) : report; const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); - const {payerAccountID, payerEmail, iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = - getMoneyRequestInformation( - currentChatReport, - participant, - comment, - amount, - currency, - currentCreated, - merchant, - payeeAccountID, - payeeEmail, - receipt, - undefined, - category, - tag, - billable, - policy, - policyTags, - policyCategories, - ); + const { + payerAccountID, + payerEmail, + iouReport, + chatReport, + transaction, + iouAction, + createdChatReportActionID, + createdIOUReportActionID, + reportPreviewAction, + transactionThreadReportID, + createdReportActionIDForThread, + onyxData, + } = getMoneyRequestInformation( + currentChatReport, + participant, + comment, + amount, + currency, + currentCreated, + merchant, + payeeAccountID, + payeeEmail, + receipt, + undefined, + category, + tag, + billable, + policy, + policyTags, + policyCategories, + ); const activeReportID = isMoneyRequestReport ? report.reportID : chatReport.reportID; API.write( @@ -1360,6 +1446,8 @@ function requestMoney( taxCode, taxAmount, billable, + transactionThreadReportID, + createdReportActionIDForThread, }, onyxData, ); @@ -1670,6 +1758,10 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco // Add tag to optimistic policy recently used tags when a participant is a workspace const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag) : {}; + // Create optimistic transactionThread + const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); + const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); + // STEP 5: Build Onyx Data const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, @@ -1697,6 +1789,8 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco createdChatReportActionID: oneOnOneCreatedActionForChat.reportActionID, createdIOUReportActionID: oneOnOneCreatedActionForIOU.reportActionID, reportPreviewReportActionID: oneOnOneReportPreviewAction.reportActionID, + transactionThreadReportID: optimisticTransactionThread.reportID, + createdReportActionIDForThread: optimisticCreatedActionForTransactionThread.reportActionID, }; splits.push(individualSplit); @@ -2230,6 +2324,9 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi oneOnOneReportPreviewAction = ReportUtils.buildOptimisticReportPreview(oneOnOneChatReport, oneOnOneIOUReport, '', oneOnOneTransaction); } + const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); + const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); + const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, oneOnOneIOUReport, @@ -2256,6 +2353,8 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi createdChatReportActionID: oneOnOneCreatedActionForChat.reportActionID, createdIOUReportActionID: oneOnOneCreatedActionForIOU.reportActionID, reportPreviewReportActionID: oneOnOneReportPreviewAction.reportActionID, + transactionThreadReportID: optimisticTransactionThread.reportID, + createdReportActionIDForThread: optimisticCreatedActionForTransactionThread.reportActionID, }); optimisticData.push(...oneOnOneOptimisticData); @@ -2918,6 +3017,9 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType const reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, optimisticIOUReport); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction, optimisticIOUReport.reportID); + const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(recipientEmail); + // First, add data that will be used in all cases const optimisticChatReportData = { onyxMethod: Onyx.METHOD.MERGE, @@ -2937,6 +3039,11 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType lastMessageHtml: optimisticIOUReportAction.message[0].html, }, }; + const optimisticTransactionThreadData = { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticTransactionThread.reportID}`, + value: optimisticTransactionThread, + }; const optimisticIOUReportActionsData = { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticIOUReport.reportID}`, @@ -2954,6 +3061,13 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType [reportPreviewAction.reportActionID]: reportPreviewAction, }, }; + const optimisticTransactionThreadReportActionsData = { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticTransactionThread.reportID}`, + value: { + [optimisticCreatedActionForTransactionThread.reportActionID]: optimisticCreatedActionForTransactionThread, + }, + }; const successData = [ { @@ -2979,6 +3093,15 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType }, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticTransactionThread.reportID}`, + value: { + [optimisticCreatedActionForTransactionThread.reportActionID]: { + pendingAction: null, + }, + }, + }, ]; const failureData = [ @@ -3056,7 +3179,15 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType }); } - const optimisticData = [optimisticChatReportData, optimisticIOUReportData, optimisticChatReportActionsData, optimisticIOUReportActionsData, optimisticTransactionData]; + const optimisticData = [ + optimisticChatReportData, + optimisticIOUReportData, + optimisticChatReportActionsData, + optimisticIOUReportActionsData, + optimisticTransactionData, + optimisticTransactionThreadData, + optimisticTransactionThreadReportActionsData, + ]; if (!_.isEmpty(optimisticPersonalDetailListData)) { optimisticData.push(optimisticPersonalDetailListData); } @@ -3071,6 +3202,8 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType newIOUReportDetails, createdReportActionID: isNewChat ? optimisticCreatedAction.reportActionID : 0, reportPreviewReportActionID: reportPreviewAction.reportActionID, + transactionThreadReportID: optimisticTransactionThread.reportID, + createdReportActionIDForThread: optimisticCreatedActionForTransactionThread.reportActionID, }, optimisticData, successData, From d1325b39026f8fbcc8eb7f427a2833dd724f1296 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 29 Jan 2024 16:11:40 -0500 Subject: [PATCH 03/21] Update LHN logic to allow Transaction Threads with Violations to be shown --- src/components/LHNOptionsList/OptionRowLHN.tsx | 11 +++++++---- src/libs/ReportUtils.ts | 12 +++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index ae225b3db9e9..923337ba9ada 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -52,8 +52,13 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti return null; } - const isHidden = optionItem?.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; - if (isHidden && !isFocused && !optionItem?.isPinned) { + const hasBrickError = optionItem.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; + const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction); + + const isHidden = optionItem.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; + + const shouldOverrideHidden = hasBrickError || isFocused || optionItem.isPinned; + if (isHidden && !shouldOverrideHidden) { return null; } @@ -74,8 +79,6 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti const hoveredBackgroundColor = !!styles.sidebarLinkHover && 'backgroundColor' in styles.sidebarLinkHover ? styles.sidebarLinkHover.backgroundColor : theme.sidebar; const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor; - const hasBrickError = optionItem.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; - const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction); /** * Show the ReportActionContextMenu modal popover. * diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 58b0489314a0..1d9b8d013cad 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3648,6 +3648,13 @@ function shouldReportBeInOptionList({ return true; } + const reportIsSettled = report.statusNum === CONST.REPORT.STATUS_NUM.REIMBURSED; + + // Always show IOU reports with violations unless they are reimbursed + if (isExpenseRequest(report) && doesReportHaveViolations && !reportIsSettled) { + return true; + } + // Hide only chat threads that haven't been commented on (other threads are actionable) if (isChatThread(report) && canHideReport && isEmptyChat) { return false; @@ -3659,11 +3666,6 @@ function shouldReportBeInOptionList({ return true; } - // Always show IOU reports with violations - if (isExpenseRequest(report) && doesReportHaveViolations) { - return true; - } - // All unread chats (even archived ones) in GSD mode will be shown. This is because GSD mode is specifically for focusing the user on the most relevant chats, primarily, the unread ones if (isInGSDMode) { return isUnread(report) && report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE; From 877915899b582594a861f90518d872a3239199d9 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 30 Jan 2024 21:10:08 -0500 Subject: [PATCH 04/21] Add optimisticTransactionThread and optimisticCreatedActionForTransactionThread --- src/libs/actions/IOU.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index e01a7a1127c3..5f47d5811da3 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1776,6 +1776,8 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco optimisticPolicyRecentlyUsedTags, isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, + optimisticTransactionThread, + optimisticCreatedActionForTransactionThread, ); const individualSplit = { @@ -2340,6 +2342,8 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi {}, isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, + optimisticTransactionThread, + optimisticCreatedActionForTransactionThread, ); splits.push({ From 6d07a21fde56b86d5f03991bf128e079720264ff Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 31 Jan 2024 09:43:12 -0500 Subject: [PATCH 05/21] Add policyTags and policyCategories to createSplitsAndOnyxData and splitBill functions --- src/libs/actions/IOU.js | 60 +++++++++++++++++-- .../step/IOURequestStepConfirmation.js | 18 +++++- .../iou/steps/MoneyRequestConfirmPage.js | 6 ++ 3 files changed, 79 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 5f47d5811da3..09e498a6faae 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1477,10 +1477,25 @@ function requestMoney( * @param {String} category * @param {String} tag * @param {String} existingSplitChatReportID - the report ID where the split bill happens, could be a group chat or a workspace chat + * @param {Array} policyTags + * @param {Array} policyCategories * * @return {Object} */ -function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '') { +function createSplitsAndOnyxData( + participants, + currentUserLogin, + currentUserAccountID, + amount, + comment, + currency, + merchant, + category, + tag, + existingSplitChatReportID = '', + policyTags, + policyCategories, +) { const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin); const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID)); const existingSplitChatReport = @@ -1762,6 +1777,9 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); + // Get the policy for the participant to determine if there should be transaction violations + const policy = ReportUtils.getPolicy(participant.policyID); + // STEP 5: Build Onyx Data const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, @@ -1778,6 +1796,9 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco shouldCreateNewOneOnOneIOUReport, optimisticTransactionThread, optimisticCreatedActionForTransactionThread, + participant.isPolicyExpenseChat && policy, + policyTags, + policyCategories, ); const individualSplit = { @@ -1830,8 +1851,23 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco * @param {String} category * @param {String} tag * @param {String} existingSplitChatReportID - Either a group DM or a workspace chat + * @param {Array} policyTags + * @param {Array} policyCategories */ -function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '') { +function splitBill( + participants, + currentUserLogin, + currentUserAccountID, + amount, + comment, + currency, + merchant, + category, + tag, + existingSplitChatReportID = '', + policyTags = [], + policyCategories = [], +) { const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, @@ -1843,6 +1879,8 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount, category, tag, existingSplitChatReportID, + policyTags, + policyCategories, ); API.write( 'SplitBill', @@ -1878,9 +1916,23 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount, * @param {String} merchant * @param {String} category * @param {String} tag + * @param {Array} policyTags + * @param {Array} policyCategories */ -function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag) { - const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag); +function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, policyTags, policyCategories) { + const {splitData, splits, onyxData} = createSplitsAndOnyxData( + participants, + currentUserLogin, + currentUserAccountID, + amount, + comment, + currency, + merchant, + category, + tag, + policyTags, + policyCategories, + ); API.write( 'SplitBillAndOpenReport', diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 6028a735d132..bd748e6681c9 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -244,6 +244,8 @@ function IOURequestStepConfirmation({ transaction.category, transaction.tag, report.reportID, + policyTags, + policyCategories, ); return; } @@ -260,6 +262,8 @@ function IOURequestStepConfirmation({ transaction.merchant, transaction.category, transaction.tag, + policyTags, + policyCategories, ); return; } @@ -276,7 +280,19 @@ function IOURequestStepConfirmation({ requestMoney(selectedParticipants, trimmedComment); }, - [iouType, transaction, currentUserPersonalDetails.login, currentUserPersonalDetails.accountID, report, requestType, createDistanceRequest, requestMoney, receiptFile], + [ + iouType, + transaction, + currentUserPersonalDetails.login, + currentUserPersonalDetails.accountID, + report, + requestType, + createDistanceRequest, + requestMoney, + receiptFile, + policyTags, + policyCategories, + ], ); /** diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 1738ac78df47..83c0d63af617 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -272,6 +272,8 @@ function MoneyRequestConfirmPage(props) { props.iou.tag, reportID, props.iou.merchant, + props.policyTags, + props.policyCategories, ); return; } @@ -288,6 +290,8 @@ function MoneyRequestConfirmPage(props) { props.iou.category, props.iou.tag, props.iou.merchant, + props.policyTags, + props.policyCategories, ); return; } @@ -321,6 +325,8 @@ function MoneyRequestConfirmPage(props) { iouType, reportID, props.iou.merchant, + props.policyTags, + props.policyCategories, ], ); From 46c3870b9632abbb393abdb343989a8e05a355c0 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 31 Jan 2024 11:11:29 -0500 Subject: [PATCH 06/21] Fix undefined values for policyTags and policyCategories in createSplitsAndOnyxData function --- src/libs/actions/IOU.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 09e498a6faae..ae0376992a04 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1493,8 +1493,8 @@ function createSplitsAndOnyxData( category, tag, existingSplitChatReportID = '', - policyTags, - policyCategories, + policyTags = undefined, + policyCategories = undefined, ) { const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin); const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID)); From d61a4ed34229f9a05f1abdd0c7b86278b5ecd2ec Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 31 Jan 2024 11:35:28 -0500 Subject: [PATCH 07/21] Remove isNewIOUReport from getMoneyRequestInformation function --- src/libs/actions/IOU.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 37d40f52bb78..77d6c23514f9 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -912,7 +912,6 @@ function getMoneyRequestInformation( optimisticPolicyRecentlyUsedCategories, optimisticPolicyRecentlyUsedTags, isNewChatReport, - isNewIOUReport, optimisticTransactionThread, optimisticCreatedActionForTransactionThread, shouldCreateNewMoneyRequestReport, From e683b8f88f9d1bccece429ee46fb7bb69a0d7c84 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 31 Jan 2024 12:20:08 -0500 Subject: [PATCH 08/21] Remove unused parameters and update function signature --- src/libs/actions/IOU.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 77d6c23514f9..7bc0f9645d48 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -349,7 +349,6 @@ function getOutstandingChildRequest(policy, needsToBeManuallySubmitted) { * @param {Array} optimisticPolicyRecentlyUsedCategories * @param {Array} optimisticPolicyRecentlyUsedTags * @param {boolean} isNewChatReport - * @param {boolean} isNewIOUReport * @param {Object} transactionThreadReport * @param {Object} transactionThreadCreatedReportAction * @param {boolean} shouldCreateNewMoneyRequestReport @@ -371,7 +370,6 @@ function buildOnyxDataForMoneyRequest( optimisticPolicyRecentlyUsedCategories, optimisticPolicyRecentlyUsedTags, isNewChatReport, - isNewIOUReport, transactionThreadReport, transactionThreadCreatedReportAction, shouldCreateNewMoneyRequestReport, @@ -1879,8 +1877,8 @@ function splitBill( category, tag, existingSplitChatReportID = '', - policyTags = [], - policyCategories = [], + policyTags = undefined, + policyCategories = undefined, ) { const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, @@ -1933,7 +1931,19 @@ function splitBill( * @param {Array} policyTags * @param {Array} policyCategories */ -function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, policyTags, policyCategories) { +function splitBillAndOpenReport( + participants, + currentUserLogin, + currentUserAccountID, + amount, + comment, + currency, + merchant, + category, + tag, + policyTags = undefined, + policyCategories = undefined, +) { const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, From 0bf73655b508f8252ddecd946a4803d90efb26d0 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Thu, 1 Feb 2024 10:29:21 -0500 Subject: [PATCH 09/21] Update IOUTest to not fail with transaction threads --- tests/actions/IOUTest.js | 87 +++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 18 deletions(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 5b304346f38f..398a07c45857 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -57,6 +57,8 @@ describe('actions/IOU', () => { let createdAction; let iouAction; let transactionID; + let transactionThread; + let transactionThreadCreatedAction; fetch.pause(); IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates() @@ -69,14 +71,16 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - // A chat report and an iou report should be created + // A chat report, a transaction thread, and an iou report should be created const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); - expect(_.size(chatReports)).toBe(1); + expect(_.size(chatReports)).toBe(2); expect(_.size(iouReports)).toBe(1); const chatReport = chatReports[0]; + const transactionThreadReport = chatReports[1]; const iouReport = iouReports[0]; iouReportID = iouReport.reportID; + transactionThread = transactionThreadReport; expect(iouReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); @@ -131,6 +135,27 @@ describe('actions/IOU', () => { }); }), ) + .then( + () => + new Promise((resolve) => { + const connectionID = Onyx.connect({ + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, + waitForCollectionCallback: true, + callback: (reportActionsForTransactionThread) => { + Onyx.disconnect(connectionID); + + // The transaction thread should have a CREATED action + expect(_.size(reportActionsForTransactionThread)).toBe(1); + const createdActions = _.filter(reportActionsForTransactionThread, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); + expect(_.size(createdActions)).toBe(1); + transactionThreadCreatedAction = createdActions[0]; + + expect(transactionThreadCreatedAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); + resolve(); + }, + }); + }), + ) .then( () => new Promise((resolve) => { @@ -236,8 +261,8 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - // The same chat report should be reused, and an IOU report should be created - expect(_.size(allReports)).toBe(2); + // The same chat report should be reused, a transaction thread and an IOU report should be created + expect(_.size(allReports)).toBe(3); expect(_.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT).reportID).toBe(chatReport.reportID); chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); @@ -430,7 +455,7 @@ describe('actions/IOU', () => { Onyx.disconnect(connectionID); // No new reports should be created - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); expect(_.find(allReports, (report) => report.reportID === chatReportID)).toBeTruthy(); expect(_.find(allReports, (report) => report.reportID === iouReportID)).toBeTruthy(); @@ -549,6 +574,8 @@ describe('actions/IOU', () => { let createdAction; let iouAction; let transactionID; + let transactionThreadReport; + let transactionThreadAction; fetch.pause(); IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return ( @@ -562,13 +589,15 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - // A chat report and an iou report should be created + // A chat report, transaction thread and an iou report should be created const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); - expect(_.size(chatReports)).toBe(1); + expect(_.size(chatReports)).toBe(2); expect(_.size(iouReports)).toBe(1); const chatReport = chatReports[0]; chatReportID = chatReport.reportID; + transactionThreadReport = chatReports[1]; + const iouReport = iouReports[0]; iouReportID = iouReport.reportID; @@ -673,6 +702,25 @@ describe('actions/IOU', () => { }); }), ) + .then( + () => + new Promise((resolve) => { + const connectionID = Onyx.connect({ + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}`, + waitForCollectionCallback: true, + callback: (reportActionsForTransactionThread) => { + Onyx.disconnect(connectionID); + expect(_.size(reportActionsForTransactionThread)).toBe(3); + transactionThreadAction = _.find( + reportActionsForTransactionThread[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`], + (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED, + ); + expect(transactionThreadAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); + resolve(); + }, + }); + }), + ) .then( () => new Promise((resolve) => { @@ -695,6 +743,7 @@ describe('actions/IOU', () => { () => new Promise((resolve) => { ReportActions.clearReportActionErrors(iouReportID, iouAction); + ReportActions.clearReportActionErrors(transactionThreadReport.reportID, transactionThreadAction); resolve(); }), ) @@ -737,6 +786,7 @@ describe('actions/IOU', () => { () => new Promise((resolve) => { Report.deleteReport(chatReportID); + Report.deleteReport(transactionThreadReport.reportID); resolve(); }), ) @@ -937,8 +987,8 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - // There should now be 7 reports - expect(_.size(allReports)).toBe(7); + // There should now be 8 reports + expect(_.size(allReports)).toBe(8); // 1. The chat report with Rory + Carlos carlosChatReport = _.find(allReports, (report) => report.reportID === carlosChatReport.reportID); @@ -1005,8 +1055,8 @@ describe('actions/IOU', () => { callback: (allReportActions) => { Onyx.disconnect(connectionID); - // There should be reportActions on all 4 chat reports + 3 IOU reports in each 1:1 chat - expect(_.size(allReportActions)).toBe(7); + // There should be reportActions on all 5 chat reports + 3 IOU reports in each 1:1 chat + expect(_.size(allReportActions)).toBe(8); const carlosReportActions = allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${carlosChatReport.iouReportID}`]; const julesReportActions = allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${julesChatReport.iouReportID}`]; @@ -1219,9 +1269,10 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); - chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); + const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); + chatReport = chatReports[0]; expect(chatReport).toBeTruthy(); expect(chatReport).toHaveProperty('reportID'); expect(chatReport).toHaveProperty('iouReportID'); @@ -1298,7 +1349,7 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT); iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU); @@ -1347,7 +1398,7 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT); iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU); @@ -1849,7 +1900,7 @@ describe('actions/IOU', () => { }), ); }); - }); + }, 15000); describe('deleteMoneyRequest', () => { const amount = 10000; @@ -1902,8 +1953,8 @@ describe('actions/IOU', () => { }); }); - // Then we should have exactly 2 reports - expect(_.size(allReports)).toBe(2); + // Then we should have exactly 3 reports + expect(_.size(allReports)).toBe(3); // Then one of them should be a chat report with relevant properties chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); From 11a63e402fadc11116b497da601b62d8a5000066 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Thu, 1 Feb 2024 10:46:26 -0500 Subject: [PATCH 10/21] Remove unneeded jest timeout --- tests/actions/IOUTest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 398a07c45857..8b71cba3c491 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -1900,7 +1900,7 @@ describe('actions/IOU', () => { }), ); }); - }, 15000); + }); describe('deleteMoneyRequest', () => { const amount = 10000; From c19372a98f8c42e195bf332b626c0f1f3917f18e Mon Sep 17 00:00:00 2001 From: Trevor Coleman Date: Thu, 1 Feb 2024 14:38:52 -0500 Subject: [PATCH 11/21] feat(Violations): reorder arguments when building onyx data, and remove policyTags & categories --- src/libs/actions/IOU.js | 42 ++----------------- .../step/IOURequestStepConfirmation.js | 2 - .../iou/steps/MoneyRequestConfirmPage.js | 3 +- tests/actions/IOUTest.js | 8 ++-- 4 files changed, 8 insertions(+), 47 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index fd32d6152665..638cc0ed3332 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1495,21 +1495,7 @@ function requestMoney( * * @return {Object} */ -function createSplitsAndOnyxData( - participants, - currentUserLogin, - currentUserAccountID, - amount, - comment, - currency, - merchant, - category, - tag, - existingSplitChatReportID = '', - billable = false, - policyTags = undefined, - policyCategories = undefined, -) { +function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '', billable = false) { const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin); const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID)); const existingSplitChatReport = @@ -1793,9 +1779,6 @@ function createSplitsAndOnyxData( const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); - // Get the policy for the participant to determine if there should be transaction violations - const policy = ReportUtils.getPolicy(participant.policyID); - // STEP 5: Build Onyx Data const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, @@ -1809,12 +1792,9 @@ function createSplitsAndOnyxData( optimisticPolicyRecentlyUsedCategories, optimisticPolicyRecentlyUsedTags, isNewOneOnOneChatReport, - shouldCreateNewOneOnOneIOUReport, optimisticTransactionThread, optimisticCreatedActionForTransactionThread, - participant.isPolicyExpenseChat && policy, - policyTags, - policyCategories, + shouldCreateNewOneOnOneIOUReport, ); const individualSplit = { @@ -1871,21 +1851,7 @@ function createSplitsAndOnyxData( * @param {Array} policyTags * @param {Array} policyCategories */ -function splitBill( - participants, - currentUserLogin, - currentUserAccountID, - amount, - comment, - currency, - merchant, - category, - tag, - existingSplitChatReportID = '', - billable = false, - policyTags = undefined, - policyCategories = undefined, -) { +function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '', billable = false) { const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, @@ -1898,8 +1864,6 @@ function splitBill( tag, existingSplitChatReportID, billable, - policyTags, - policyCategories, ); API.write( 'SplitBill', diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 30552126cd65..0cd131dc7107 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -246,8 +246,6 @@ function IOURequestStepConfirmation({ transaction.tag, report.reportID, transaction.billable, - policyTags, - policyCategories, ); return; } diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 83c0d63af617..1ac739696734 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -272,8 +272,7 @@ function MoneyRequestConfirmPage(props) { props.iou.tag, reportID, props.iou.merchant, - props.policyTags, - props.policyCategories, + false, ); return; } diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 8b71cba3c491..f9743cf10afd 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -987,8 +987,8 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - // There should now be 8 reports - expect(_.size(allReports)).toBe(8); + // There should now be 10 reports + expect(_.size(allReports)).toBe(10); // 1. The chat report with Rory + Carlos carlosChatReport = _.find(allReports, (report) => report.reportID === carlosChatReport.reportID); @@ -1055,8 +1055,8 @@ describe('actions/IOU', () => { callback: (allReportActions) => { Onyx.disconnect(connectionID); - // There should be reportActions on all 5 chat reports + 3 IOU reports in each 1:1 chat - expect(_.size(allReportActions)).toBe(8); + // There should be reportActions on all 7 chat reports + 3 IOU reports in each 1:1 chat + expect(_.size(allReportActions)).toBe(10); const carlosReportActions = allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${carlosChatReport.iouReportID}`]; const julesReportActions = allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${julesChatReport.iouReportID}`]; From da579792bb56c1b87225afae6b68a33774ad794c Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 6 Feb 2024 11:34:51 -0500 Subject: [PATCH 12/21] Update optimistic transaction thread logic for typscript conversion --- .../API/parameters/CreateDistanceRequestParams.ts | 2 ++ src/libs/API/parameters/RequestMoneyParams.ts | 2 ++ src/libs/API/parameters/SendMoneyParams.ts | 2 ++ src/libs/actions/IOU.ts | 12 ++++++------ src/types/onyx/IOU.ts | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/libs/API/parameters/CreateDistanceRequestParams.ts b/src/libs/API/parameters/CreateDistanceRequestParams.ts index c1eb1003a698..62f90a64cf05 100644 --- a/src/libs/API/parameters/CreateDistanceRequestParams.ts +++ b/src/libs/API/parameters/CreateDistanceRequestParams.ts @@ -12,6 +12,8 @@ type CreateDistanceRequestParams = { category?: string; tag?: string; billable?: boolean; + transactionThreadReportID: string; + createdReportActionIDForThread: string; }; export default CreateDistanceRequestParams; diff --git a/src/libs/API/parameters/RequestMoneyParams.ts b/src/libs/API/parameters/RequestMoneyParams.ts index ccafdd692137..4e5153083027 100644 --- a/src/libs/API/parameters/RequestMoneyParams.ts +++ b/src/libs/API/parameters/RequestMoneyParams.ts @@ -24,6 +24,8 @@ type RequestMoneyParams = { taxCode: string; taxAmount: number; billable?: boolean; + transactionThreadReportID: string; + createdReportActionIDForThread: string; }; export default RequestMoneyParams; diff --git a/src/libs/API/parameters/SendMoneyParams.ts b/src/libs/API/parameters/SendMoneyParams.ts index c32287d5b4ec..dce9845421d6 100644 --- a/src/libs/API/parameters/SendMoneyParams.ts +++ b/src/libs/API/parameters/SendMoneyParams.ts @@ -10,6 +10,8 @@ type SendMoneyParams = { newIOUReportDetails: string; createdReportActionID: string; reportPreviewReportActionID: string; + transactionThreadReportID: string; + createdReportActionIDForThread: string; }; export default SendMoneyParams; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index c34c4905fc39..832865c1807c 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -888,7 +888,7 @@ function getMoneyRequestInformation( false, currentTime, ); - const optimisticTransactionThread = ReportUtils.buildTransactionThread(iouAction, iouReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(iouAction as OnyxEntry, iouReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(payeeEmail); let reportPreviewAction = shouldCreateNewMoneyRequestReport ? null : ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); @@ -1739,7 +1739,7 @@ function createSplitsAndOnyxData( const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag) : {}; // Create optimistic transactionThread - const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction as OnyxEntry, oneOnOneIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); // STEP 5: Build Onyx Data @@ -2332,7 +2332,7 @@ function completeSplitBill(chatReportID: string, reportAction: OnyxTypes.ReportA oneOnOneReportPreviewAction = ReportUtils.buildOptimisticReportPreview(oneOnOneChatReport, oneOnOneIOUReport, '', oneOnOneTransaction); } - const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction as OnyxEntry, oneOnOneIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( @@ -2347,9 +2347,9 @@ function completeSplitBill(chatReportID: string, reportAction: OnyxTypes.ReportA [], {}, isNewOneOnOneChatReport, - shouldCreateNewOneOnOneIOUReport, optimisticTransactionThread, optimisticCreatedActionForTransactionThread, + shouldCreateNewOneOnOneIOUReport, ); splits.push({ @@ -3014,7 +3014,7 @@ function getSendMoneyParams( const reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, optimisticIOUReport); - const optimisticTransactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction, optimisticIOUReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction as OnyxEntry, optimisticIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(recipientEmail); // Change the method to set for new reports because it doesn't exist yet, is faster, @@ -3071,7 +3071,7 @@ function getSendMoneyParams( [reportPreviewAction.reportActionID]: reportPreviewAction, }, }; - const optimisticTransactionThreadReportActionsData = { + const optimisticTransactionThreadReportActionsData: OnyxUpdate = { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticTransactionThread.reportID}`, value: { diff --git a/src/types/onyx/IOU.ts b/src/types/onyx/IOU.ts index b04011978d73..6bbcb174a617 100644 --- a/src/types/onyx/IOU.ts +++ b/src/types/onyx/IOU.ts @@ -35,6 +35,8 @@ type Split = { createdChatReportActionID?: string; createdIOUReportActionID?: string; reportPreviewReportActionID?: string; + transactionThreadReportID?: string; + createdReportActionIDForThread?: string; }; type IOU = { From f06d5b02a044b48554c69d55cf5148ca63bb8c3d Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 6 Feb 2024 15:49:32 -0500 Subject: [PATCH 13/21] Refactor buildTransactionThread function calls in IOU.ts --- src/libs/actions/IOU.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 832865c1807c..1da26ccf4b65 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -888,7 +888,7 @@ function getMoneyRequestInformation( false, currentTime, ); - const optimisticTransactionThread = ReportUtils.buildTransactionThread(iouAction as OnyxEntry, iouReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(iouAction, iouReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(payeeEmail); let reportPreviewAction = shouldCreateNewMoneyRequestReport ? null : ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); @@ -1739,7 +1739,7 @@ function createSplitsAndOnyxData( const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag) : {}; // Create optimistic transactionThread - const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction as OnyxEntry, oneOnOneIOUReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); // STEP 5: Build Onyx Data @@ -2332,7 +2332,7 @@ function completeSplitBill(chatReportID: string, reportAction: OnyxTypes.ReportA oneOnOneReportPreviewAction = ReportUtils.buildOptimisticReportPreview(oneOnOneChatReport, oneOnOneIOUReport, '', oneOnOneTransaction); } - const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction as OnyxEntry, oneOnOneIOUReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUAction, oneOnOneIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( @@ -3014,7 +3014,7 @@ function getSendMoneyParams( const reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, optimisticIOUReport); - const optimisticTransactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction as OnyxEntry, optimisticIOUReport.reportID); + const optimisticTransactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction, optimisticIOUReport.reportID); const optimisticCreatedActionForTransactionThread = ReportUtils.buildOptimisticCreatedReportAction(recipientEmail); // Change the method to set for new reports because it doesn't exist yet, is faster, From 9a5baefe86874a0db526f5c922e746f88470eba4 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Thu, 8 Feb 2024 10:54:20 -0500 Subject: [PATCH 14/21] Update ReportActionsUtils, ReportUtils, and TransactionUtils types --- src/libs/ReportActionsUtils.ts | 15 +++++++++------ src/libs/ReportUtils.ts | 4 ++-- src/libs/TransactionUtils.ts | 6 ++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 1aeb6e6e7343..f48f843a41bc 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -6,7 +6,7 @@ import Onyx from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import type {ActionName, ChangeLog, OriginalMessageReimbursementDequeued} from '@src/types/onyx/OriginalMessage'; +import type {ActionName, ChangeLog, IOUMessage, OriginalMessageReimbursementDequeued} from '@src/types/onyx/OriginalMessage'; import type Report from '@src/types/onyx/Report'; import type {Message, ReportActionBase, ReportActions} from '@src/types/onyx/ReportAction'; import type ReportAction from '@src/types/onyx/ReportAction'; @@ -19,6 +19,7 @@ import * as Localize from './Localize'; import Log from './Log'; import type {MessageElementBase, MessageTextElement} from './MessageElement'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; +import type {OptimisticIOUReportAction} from './ReportUtils'; type LastVisibleMessage = { lastMessageTranslationKey?: string; @@ -80,7 +81,7 @@ function isCreatedAction(reportAction: OnyxEntry): boolean { return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED; } -function isDeletedAction(reportAction: OnyxEntry): boolean { +function isDeletedAction(reportAction: OnyxEntry): boolean { // A deleted comment has either an empty array or an object with html field with empty string as value const message = reportAction?.message ?? []; return message.length === 0 || message[0]?.html === ''; @@ -90,8 +91,8 @@ function isDeletedParentAction(reportAction: OnyxEntry): boolean { return (reportAction?.message?.[0]?.isDeletedParentAction ?? false) && (reportAction?.childVisibleActionCount ?? 0) > 0; } -function isReversedTransaction(reportAction: OnyxEntry) { - return (reportAction?.message?.[0]?.isReversedTransaction ?? false) && (reportAction?.childVisibleActionCount ?? 0) > 0; +function isReversedTransaction(reportAction: OnyxEntry) { + return (reportAction?.message?.[0]?.isReversedTransaction ?? false) && ((reportAction as ReportAction)?.childVisibleActionCount ?? 0) > 0; } function isPendingRemove(reportAction: OnyxEntry | EmptyObject): boolean { @@ -161,9 +162,11 @@ function getParentReportAction(report: OnyxEntry | EmptyObject): ReportA /** * Determines if the given report action is sent money report action by checking for 'pay' type and presence of IOUDetails object. */ -function isSentMoneyReportAction(reportAction: OnyxEntry): boolean { +function isSentMoneyReportAction(reportAction: OnyxEntry): boolean { return ( - reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && reportAction?.originalMessage?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !!reportAction?.originalMessage?.IOUDetails + reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && + (reportAction?.originalMessage as IOUMessage)?.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && + !!(reportAction?.originalMessage as IOUMessage)?.IOUDetails ); } diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a15943210a14..9fff1399593e 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2171,7 +2171,7 @@ function hasMissingSmartscanFields(iouReportID: string): boolean { /** * Given a parent IOU report action get report name for the LHN. */ -function getTransactionReportName(reportAction: OnyxEntry): string { +function getTransactionReportName(reportAction: OnyxEntry): string { if (ReportActionsUtils.isReversedTransaction(reportAction)) { return Localize.translateLocal('parentReportAction.reversedTransaction'); } @@ -3540,7 +3540,7 @@ function buildOptimisticTaskReport( * * @param moneyRequestReportID - the reportID which the report action belong to */ -function buildTransactionThread(reportAction: OnyxEntry, moneyRequestReportID: string): OptimisticChatReport { +function buildTransactionThread(reportAction: OnyxEntry, moneyRequestReportID: string): OptimisticChatReport { const participantAccountIDs = [...new Set([currentUserAccountID, Number(reportAction?.actorAccountID)])].filter(Boolean) as number[]; return buildOptimisticChatReport( participantAccountIDs, diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 8a814f311481..33ca06d7f122 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -5,12 +5,14 @@ import type {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {RecentWaypoint, Report, ReportAction, Transaction, TransactionViolation} from '@src/types/onyx'; +import type {IOUMessage} from '@src/types/onyx/OriginalMessage'; import type {PolicyTaxRate, PolicyTaxRates} from '@src/types/onyx/PolicyTaxRates'; import type {Comment, Receipt, TransactionChanges, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction'; import type {EmptyObject} from '@src/types/utils/EmptyObject'; import {isCorporateCard, isExpensifyCard} from './CardUtils'; import DateUtils from './DateUtils'; import * as NumberUtils from './NumberUtils'; +import type {OptimisticIOUReportAction} from './ReportUtils'; let allTransactions: OnyxCollection = {}; @@ -448,11 +450,11 @@ function hasRoute(transaction: Transaction): boolean { * * @deprecated Use Onyx.connect() or withOnyx() instead */ -function getLinkedTransaction(reportAction: OnyxEntry): Transaction | EmptyObject { +function getLinkedTransaction(reportAction: OnyxEntry): Transaction | EmptyObject { let transactionID = ''; if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU) { - transactionID = reportAction.originalMessage?.IOUTransactionID ?? ''; + transactionID = (reportAction?.originalMessage as IOUMessage)?.IOUTransactionID ?? ''; } return allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`] ?? {}; From 8b5c13208f639351eb6f3b22099346adb4cfb246 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 13 Feb 2024 10:32:17 -0500 Subject: [PATCH 15/21] Rearrange function parameters for MoneyRequestConfirmPage --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 1ac739696734..0b48eb9ac47d 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -268,10 +268,10 @@ function MoneyRequestConfirmPage(props) { props.iou.amount, trimmedComment, props.iou.currency, + props.iou.merchant, props.iou.category, props.iou.tag, reportID, - props.iou.merchant, false, ); return; From e33cc2309a6ab5b58185a8f0b045b225b9effb2e Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 13 Feb 2024 10:38:15 -0500 Subject: [PATCH 16/21] Refactor MoneyRequestConfirmPage.js to include merchant information --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 0b48eb9ac47d..2c5990e26d15 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -286,11 +286,9 @@ function MoneyRequestConfirmPage(props) { props.iou.amount, trimmedComment, props.iou.currency, + props.iou.merchant, props.iou.category, props.iou.tag, - props.iou.merchant, - props.policyTags, - props.policyCategories, ); return; } @@ -324,8 +322,6 @@ function MoneyRequestConfirmPage(props) { iouType, reportID, props.iou.merchant, - props.policyTags, - props.policyCategories, ], ); From 2e3d3dadb8c5f9ab17c7c9f7a501e2da7aa52c03 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 13 Feb 2024 11:01:06 -0500 Subject: [PATCH 17/21] Update onyxMethod in IOU.ts --- src/libs/actions/IOU.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 14e6612620eb..7381bc5ad196 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -475,12 +475,12 @@ function buildOnyxDataForMoneyRequest( }, { - onyxMethod: Onyx.METHOD.SET, + onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport.reportID}`, value: transactionThreadReport, }, { - onyxMethod: Onyx.METHOD.SET, + onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`, value: { [transactionThreadCreatedReportAction.reportActionID]: transactionThreadCreatedReportAction, From 1449800cea264daf969bc9682741ab42f1ca1b4b Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Tue, 13 Feb 2024 12:19:06 -0500 Subject: [PATCH 18/21] Add error handling data for transaction thread report and report actions --- src/libs/actions/IOU.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 7381bc5ad196..842711a8fde2 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3298,6 +3298,24 @@ function getSendMoneyParams( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.other'), }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticTransactionThread.reportID}`, + value: { + errorFields: { + createChat: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'), + }, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticTransactionThread.reportID}`, + value: { + [optimisticCreatedActionForTransactionThread.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + }, + }, + }, ]; let optimisticPersonalDetailListData: OnyxUpdate | EmptyObject = {}; From f9b3e541c5695c4623f6388e05a7f3e720f03a45 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Fri, 16 Feb 2024 09:42:12 -0500 Subject: [PATCH 19/21] Remove unnecessary code and fix merchant parameter in MoneyRequestConfirmPage.js --- src/pages/iou/steps/MoneyRequestConfirmPage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/steps/MoneyRequestConfirmPage.js b/src/pages/iou/steps/MoneyRequestConfirmPage.js index 2c5990e26d15..1738ac78df47 100644 --- a/src/pages/iou/steps/MoneyRequestConfirmPage.js +++ b/src/pages/iou/steps/MoneyRequestConfirmPage.js @@ -268,11 +268,10 @@ function MoneyRequestConfirmPage(props) { props.iou.amount, trimmedComment, props.iou.currency, - props.iou.merchant, props.iou.category, props.iou.tag, reportID, - false, + props.iou.merchant, ); return; } @@ -286,9 +285,9 @@ function MoneyRequestConfirmPage(props) { props.iou.amount, trimmedComment, props.iou.currency, - props.iou.merchant, props.iou.category, props.iou.tag, + props.iou.merchant, ); return; } From 4dd1d7df975efbceb94fb8c154b5e1a9cc907fc7 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Fri, 16 Feb 2024 09:48:45 -0500 Subject: [PATCH 20/21] Remove unused variables in IOURequestStepConfirmation.js --- src/pages/iou/request/step/IOURequestStepConfirmation.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 547870a580e1..7d4d7f04bb7e 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -308,8 +308,6 @@ function IOURequestStepConfirmation({ transaction.category, transaction.tag, transaction.billable, - policyTags, - policyCategories, ); return; } @@ -362,8 +360,6 @@ function IOURequestStepConfirmation({ createDistanceRequest, requestMoney, receiptFile, - policyTags, - policyCategories, ], ); From 25d2b776a5acd49afa63a6adbc735351f7e3dfc2 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Fri, 16 Feb 2024 09:51:09 -0500 Subject: [PATCH 21/21] Refactor IOURequestStepConfirmation function parameters --- .../iou/request/step/IOURequestStepConfirmation.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.js b/src/pages/iou/request/step/IOURequestStepConfirmation.js index 7d4d7f04bb7e..00055d6048f8 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.js +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.js @@ -350,17 +350,7 @@ function IOURequestStepConfirmation({ requestMoney(selectedParticipants, trimmedComment); }, - [ - iouType, - transaction, - currentUserPersonalDetails.login, - currentUserPersonalDetails.accountID, - report, - requestType, - createDistanceRequest, - requestMoney, - receiptFile, - ], + [iouType, transaction, currentUserPersonalDetails.login, currentUserPersonalDetails.accountID, report, requestType, createDistanceRequest, requestMoney, receiptFile], ); /**