diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a104b98175c4..a48613a633c4 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1700,6 +1700,16 @@ function isOneTransactionThread(reportID: string, parentReportID: string, thread return reportID === transactionThreadReportID && !ReportActionsUtils.isSentMoneyReportAction(threadParentReportAction); } +/** + * Get displayed report ID, it will be parentReportID if the report is one transaction thread + */ +function getDisplayedReportID(reportID: string): string { + const report = getReport(reportID); + const parentReportID = report?.parentReportID ?? ''; + const parentReportAction = ReportActionsUtils.getReportAction(parentReportID, report?.parentReportActionID ?? ''); + return isOneTransactionThread(reportID, parentReportID, parentReportAction) ? parentReportID : reportID; +} + /** * Should return true only for personal 1:1 report * @@ -8555,6 +8565,7 @@ export { getTaskAssigneeChatOnyxData, getTransactionDetails, getTransactionReportName, + getDisplayedReportID, getTransactionsWithReceipts, getUserDetailTooltipText, getWhisperDisplayNames, diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 1db2555f3393..b6c4377eb54b 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -8126,6 +8126,9 @@ function putOnHold(transactionID: string, comment: string, reportID: string, sea }, {optimisticData, successData, failureData}, ); + + const currentReportID = ReportUtils.getDisplayedReportID(reportID); + Report.notifyNewAction(currentReportID, userAccountID); } /** @@ -8225,6 +8228,9 @@ function unholdRequest(transactionID: string, reportID: string, searchHash?: num }, {optimisticData, successData, failureData}, ); + + const currentReportID = ReportUtils.getDisplayedReportID(reportID); + Report.notifyNewAction(currentReportID, userAccountID); } // eslint-disable-next-line rulesdir/no-negated-variables function navigateToStartStepIfScanFileCannotBeRead(