Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
hasViolations as hasViolationsReportUtils,
isAllowedToApproveExpenseReport,
isCurrentUserSubmitter,
isDM,
isExported as isExportedUtils,
isInvoiceReport as isInvoiceReportUtil,
isProcessingReport,
Expand Down Expand Up @@ -422,6 +423,7 @@ function MoneyReportHeader({
const shouldDisplaySearchRouter = !isReportInRHP || isSmallScreenWidth;
const isReportInSearch = route.name === SCREENS.SEARCH.MONEY_REQUEST_REPORT;
const isReportSubmitter = isCurrentUserSubmitter(chatIOUReport);
const isChatReportDM = isDM(chatReport);

const existingB2BInvoiceReport = useParticipantsInvoiceReport(activePolicyID, CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS, chatReport?.policyID);
const confirmPayment = useCallback(
Expand Down Expand Up @@ -1038,7 +1040,7 @@ function MoneyReportHeader({

const isDismissed = isReportSubmitter ? dismissedHoldUseExplanation : dismissedRejectUseExplanation;

if (isDismissed) {
if (isDismissed || isChatReportDM) {
changeMoneyRequestHoldStatus(requestParentReportAction);
} else if (isReportSubmitter) {
setIsHoldEducationalModalVisible(true);
Expand Down
5 changes: 3 additions & 2 deletions src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type {ReportsSplitNavigatorParamList, SearchReportParamList} from '@libs/
import {getOriginalMessage, isMoneyRequestAction, isTrackExpenseAction} from '@libs/ReportActionsUtils';
import {getTransactionThreadPrimaryAction, isMarkAsResolvedAction} from '@libs/ReportPrimaryActionUtils';
import {getSecondaryTransactionThreadActions} from '@libs/ReportSecondaryActionUtils';
import {changeMoneyRequestHoldStatus, isCurrentUserSubmitter, isSelfDM, navigateToDetailsPage, rejectMoneyRequestReason} from '@libs/ReportUtils';
import {changeMoneyRequestHoldStatus, isCurrentUserSubmitter, isDM, isSelfDM, navigateToDetailsPage, rejectMoneyRequestReason} from '@libs/ReportUtils';
import {getReviewNavigationRoute} from '@libs/TransactionPreviewUtils';
import {
getOriginalTransactionWithSplitInfo,
Expand Down Expand Up @@ -132,6 +132,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre

const shouldShowBrokenConnectionViolation = shouldShowBrokenConnectionViolationTransactionUtils(parentReport, policy, transactionViolations);
const isReportSubmitter = isCurrentUserSubmitter(chatIOUReport);
const isParentReportDM = isDM(parentReport);
Copy link
Contributor

Choose a reason for hiding this comment

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

👋 Hey, coming from #75520
This has caused an issue with educational modal(s) appearing twice (HOLD modal on the first hold, HOLD&REJECT on the next one)
We should have used chatIOUReport instead of parentReport (same as in MoneyReportHeader)


// If the parent report is a selfDM, it should always be opened in the Inbox tab
const shouldOpenParentReportInCurrentTab = !isSelfDM(parentReport);
Expand Down Expand Up @@ -306,7 +307,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre

const isDismissed = isReportSubmitter ? dismissedHoldUseExplanation : dismissedRejectUseExplanation;

if (isDismissed) {
if (isDismissed || isParentReportDM) {
changeMoneyRequestHoldStatus(parentReportAction);
} else if (isReportSubmitter) {
setIsHoldEducationalModalVisible(true);
Expand Down
Loading