From 94c20d7af722f9c5c720b4ca1ba0620b90ddfe9d Mon Sep 17 00:00:00 2001 From: Ali Toshmatov Date: Mon, 28 Aug 2023 22:13:30 +0500 Subject: [PATCH 1/2] Modified buildTransactionThread function to accept requestReportID --- src/components/ReportActionItem/MoneyRequestAction.js | 2 +- src/libs/ReportUtils.js | 4 ++-- src/pages/home/report/ContextMenu/ContextMenuActions.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestAction.js b/src/components/ReportActionItem/MoneyRequestAction.js index 5e5ee4829786..bb312f85be41 100644 --- a/src/components/ReportActionItem/MoneyRequestAction.js +++ b/src/components/ReportActionItem/MoneyRequestAction.js @@ -100,7 +100,7 @@ function MoneyRequestAction({ // If the childReportID is not present, we need to create a new thread const childReportID = lodashGet(action, 'childReportID', 0); if (!childReportID) { - const thread = ReportUtils.buildTransactionThread(action); + const thread = ReportUtils.buildTransactionThread(action, requestReportID); const userLogins = PersonalDetailsUtils.getLoginsByAccountIDs(thread.participantAccountIDs); Report.openReport(thread.reportID, userLogins, thread, action.reportActionID); Navigation.navigate(ROUTES.getReportRoute(thread.reportID)); diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 264fefac8753..48873a8699f9 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2502,7 +2502,7 @@ function buildOptimisticTaskReport(ownerAccountID, assigneeAccountID = 0, parent * * @returns {Object} */ -function buildTransactionThread(reportAction) { +function buildTransactionThread(reportAction, moneyRequestReportID) { const participantAccountIDs = _.uniq([currentUserAccountID, Number(reportAction.actorAccountID)]); return buildOptimisticChatReport( participantAccountIDs, @@ -2516,7 +2516,7 @@ function buildTransactionThread(reportAction) { undefined, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, reportAction.reportActionID, - reportAction.reportID, + moneyRequestReportID, ); } diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index a3621da3e820..bac79e1863e5 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -284,7 +284,7 @@ export default [ hideContextMenu(false); const childReportID = lodashGet(reportAction, 'childReportID', 0); if (!childReportID) { - const thread = ReportUtils.buildTransactionThread(reportAction); + const thread = ReportUtils.buildTransactionThread(reportAction, reportID); const userLogins = PersonalDetailsUtils.getLoginsByAccountIDs(thread.participantAccountIDs); Report.openReport(thread.reportID, userLogins, thread, reportAction.reportActionID); Navigation.navigate(ROUTES.getReportRoute(thread.reportID)); From 341803ae28c30977bab0dc512d7606e212cfc7da Mon Sep 17 00:00:00 2001 From: Ali Toshmatov Date: Tue, 29 Aug 2023 00:38:36 +0500 Subject: [PATCH 2/2] Added jsdoc to second argument of buildTransactionThread --- src/libs/ReportUtils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 48873a8699f9..aeebb61f1840 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2500,6 +2500,8 @@ function buildOptimisticTaskReport(ownerAccountID, assigneeAccountID = 0, parent * * @param {Object} reportAction - the parent IOU report action from which to create the thread * + * @param {String} moneyRequestReportID - the reportID which the report action belong to + * * @returns {Object} */ function buildTransactionThread(reportAction, moneyRequestReportID) {