Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Expense - Submit button appears for archived workspace chat if delayed submission is enabled #52183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4f1e036
separated isArchivedExpenseReport
FitseTLT Nov 7, 2024
e479b03
hide approve and submit button for archived expense reports
FitseTLT Nov 7, 2024
80079f1
removed isArchived conditions
FitseTLT Nov 11, 2024
6baee2f
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Nov 13, 2024
d1e30bb
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Nov 13, 2024
6e97db2
removed unnecessary code
FitseTLT Nov 13, 2024
58258ed
remove unnecessary condition
FitseTLT Nov 13, 2024
e0da388
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Nov 14, 2024
1f48cb9
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Nov 20, 2024
a79e87b
updated isArchived conditions
FitseTLT Nov 21, 2024
367f750
changed function name
FitseTLT Nov 21, 2024
10afdfb
resolved conflicts
FitseTLT Nov 25, 2024
4a8865d
minor fix
FitseTLT Nov 25, 2024
76b27d1
updated based on comments
FitseTLT Nov 25, 2024
9e36537
updated hold cases
FitseTLT Nov 25, 2024
eba01f4
fix lint
FitseTLT Nov 25, 2024
f9b33a5
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Nov 26, 2024
76a7157
additional changes
FitseTLT Nov 27, 2024
1241ae3
allowed actions for archived expense requests
FitseTLT Nov 27, 2024
dc76f27
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Nov 27, 2024
3cc72aa
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Dec 4, 2024
7e8e192
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Dec 4, 2024
6983f3a
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Dec 9, 2024
d68c6c8
made more changes
FitseTLT Dec 9, 2024
acfa644
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Jan 6, 2025
f3a150a
minor fix
FitseTLT Jan 6, 2025
2ccb1aa
minor fix
FitseTLT Jan 6, 2025
3d47bca
fix lint
FitseTLT Jan 6, 2025
79ecf64
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Jan 6, 2025
1d6f146
lint fix
FitseTLT Jan 6, 2025
b28ce3c
lint fix
FitseTLT Jan 6, 2025
33a9c1a
minor fix
FitseTLT Jan 6, 2025
2f69e3d
lint fix
FitseTLT Jan 6, 2025
0de9910
fix lint
FitseTLT Jan 6, 2025
7ea58c7
lint fix
FitseTLT Jan 6, 2025
6f9093a
minor fix
FitseTLT Jan 6, 2025
02e102a
lint fix
FitseTLT Jan 6, 2025
949f169
minor fix
FitseTLT Jan 6, 2025
466da88
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Jan 8, 2025
997781a
minor fix
FitseTLT Jan 8, 2025
c239018
fix getLastMessageTextForReport
FitseTLT Jan 8, 2025
800996e
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Jan 9, 2025
4238c73
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Jan 13, 2025
6e688e1
Merge branch 'main' into fix-expense-report-for-archived-workspaces
FitseTLT Jan 13, 2025
7b22d11
minor fix
FitseTLT Jan 13, 2025
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
6 changes: 3 additions & 3 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const ROUTES = {
},
REPORT_WITH_ID_DETAILS: {
route: 'r/:reportID/details',
getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/details`, backTo),
getRoute: (reportID: string | undefined, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/details`, backTo),
},
REPORT_WITH_ID_DETAILS_EXPORT: {
route: 'r/:reportID/details/export/:connectionName',
Expand Down Expand Up @@ -399,7 +399,7 @@ const ROUTES = {
},
REPORT_DESCRIPTION: {
route: 'r/:reportID/description',
getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/description` as const, backTo),
getRoute: (reportID: string | undefined, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/description` as const, backTo),
},
TASK_ASSIGNEE: {
route: 'r/:reportID/assignee',
Expand Down Expand Up @@ -1479,7 +1479,7 @@ const ROUTES = {

TRANSACTION_DUPLICATE_REVIEW_PAGE: {
route: 'r/:threadReportID/duplicates/review',
getRoute: (threadReportID: string, backTo?: string) => getUrlWithBackToParam(`r/${threadReportID}/duplicates/review` as const, backTo),
getRoute: (threadReportID: string | undefined, backTo?: string) => getUrlWithBackToParam(`r/${threadReportID}/duplicates/review` as const, backTo),
},
TRANSACTION_DUPLICATE_REVIEW_MERCHANT_PAGE: {
route: 'r/:threadReportID/duplicates/review/merchant',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import * as Browser from '@libs/Browser';

Check failure on line 9 in src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import fileDownload from '@libs/fileDownload';
import * as ReportUtils from '@libs/ReportUtils';

Check failure on line 11 in src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as Download from '@userActions/Download';

Check failure on line 12 in src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type AnchorForAttachmentsOnlyProps from './types';
Expand Down Expand Up @@ -51,7 +51,7 @@
if (isDisabled) {
return;
}
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedNonExpenseReport(report, reportNameValuePairs));
}}
shouldUseHapticsOnLongPress
accessibilityLabel={displayName}
Expand Down
6 changes: 3 additions & 3 deletions src/components/BrokenConnectionDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import {useOnyx} from 'react-native-onyx';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as PolicyUtils from '@libs/PolicyUtils';

Check failure on line 6 in src/components/BrokenConnectionDescription.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as ReportUtils from '@libs/ReportUtils';

Check failure on line 7 in src/components/BrokenConnectionDescription.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import Navigation from '@navigation/Navigation';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -14,7 +14,7 @@

type BrokenConnectionDescriptionProps = {
/** Transaction id of the corresponding report */
transactionID: string;
transactionID: string | undefined;

/** Current report */
report: OnyxEntry<Report>;
Expand All @@ -40,13 +40,13 @@
return translate('violations.brokenConnection530Error');
}

if (isPolicyAdmin && !ReportUtils.isCurrentUserSubmitter(report?.reportID ?? '')) {
if (isPolicyAdmin && !ReportUtils.isCurrentUserSubmitter(report?.reportID)) {
return (
<>
{`${translate('violations.adminBrokenConnectionError')}`}
<TextLink
style={[styles.textLabelSupporting, styles.link]}
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(policy?.id ?? '-1'))}
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(policy?.id))}
>{`${translate('workspace.common.companyCards')}`}</TextLink>
.
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as FileUtils from '@libs/fileDownload/FileUtils';

Check failure on line 14 in src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';

Check failure on line 16 in src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -117,7 +117,14 @@
if (isDisabled) {
return;
}
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
showContextMenuForReport(
event,
anchor,
report?.reportID,
action,
checkIfContextMenuActive,
ReportUtils.isArchivedNonExpenseReport(report, reportNameValuePairs),
);
}}
shouldUseHapticsOnLongPress
accessibilityRole={CONST.ROLE.BUTTON}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import * as LocalePhoneNumber from '@libs/LocalePhoneNumber';

Check failure on line 17 in src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as LoginUtils from '@libs/LoginUtils';

Check failure on line 18 in src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import Navigation from '@libs/Navigation/Navigation';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';

Check failure on line 20 in src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import * as ReportUtils from '@libs/ReportUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -91,7 +91,7 @@
if (isDisabled) {
return;
}
showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedNonExpenseReport(report, reportNameValuePairs));
}}
onPress={(event) => {
event.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function PreRenderer({TDefaultRenderer, onPressIn, onPressOut, onLongPress, ...d
if (isDisabled) {
return;
}
showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedNonExpenseReport(report, reportNameValuePairs));
}}
shouldUseHapticsOnLongPress
role={CONST.ROLE.PRESENTATION}
Expand Down
45 changes: 24 additions & 21 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type MoneyReportHeaderProps = {

/** The reportID of the transaction thread report associated with this current report, if any */
// eslint-disable-next-line react/no-unused-prop-types
transactionThreadReportID?: string | null;
transactionThreadReportID: string | undefined;

/** Method to trigger when pressing close button of the header */
onBackButtonPress: () => void;
Expand All @@ -67,8 +67,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const route = useRoute();
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID ?? '-1'}`);
const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID ?? '-1'}`);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID}`);
const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID}`);
const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`);
const [session] = useOnyx(ONYXKEYS.SESSION);
const requestParentReportAction = useMemo(() => {
Expand All @@ -83,7 +83,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const transaction =
transactions?.[
`${ONYXKEYS.COLLECTION.TRANSACTION}${
ReportActionsUtils.isMoneyRequestAction(requestParentReportAction) ? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID ?? -1 : -1
ReportActionsUtils.isMoneyRequestAction(requestParentReportAction) && ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID
}`
] ?? undefined;

Expand All @@ -96,7 +96,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const {reimbursableSpend} = ReportUtils.getMoneyRequestSpendBreakdown(moneyRequestReport);
const isOnHold = TransactionUtils.isOnHold(transaction);
const isDeletedParentAction = !!requestParentReportAction && ReportActionsUtils.isDeletedAction(requestParentReportAction);
const isDuplicate = TransactionUtils.isDuplicate(transaction?.transactionID ?? '');
const isDuplicate = TransactionUtils.isDuplicate(transaction?.transactionID);

// Only the requestor can delete the request, admins can only edit it.
const isActionOwner =
Expand All @@ -115,12 +115,12 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const hasScanningReceipt = ReportUtils.getTransactionsWithReceipts(moneyRequestReport?.reportID).some((t) => TransactionUtils.isReceiptBeingScanned(t));
const hasOnlyPendingTransactions = allTransactions.length > 0 && allTransactions.every((t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t));
const transactionIDs = allTransactions.map((t) => t.transactionID);
const hasAllPendingRTERViolations = TransactionUtils.allHavePendingRTERViolation([transaction?.transactionID ?? '-1']);
const shouldShowBrokenConnectionViolation = TransactionUtils.shouldShowBrokenConnectionViolation(transaction?.transactionID ?? '-1', moneyRequestReport, policy);
const hasOnlyHeldExpenses = ReportUtils.hasOnlyHeldExpenses(moneyRequestReport?.reportID ?? '');
const hasAllPendingRTERViolations = TransactionUtils.allHavePendingRTERViolation([transaction?.transactionID]);
const shouldShowBrokenConnectionViolation = TransactionUtils.shouldShowBrokenConnectionViolation(transaction?.transactionID, moneyRequestReport, policy);
const hasOnlyHeldExpenses = ReportUtils.hasOnlyHeldExpenses(moneyRequestReport?.reportID);
const isPayAtEndExpense = TransactionUtils.isPayAtEndExpense(transaction);
const isArchivedReport = ReportUtils.isArchivedRoomWithID(moneyRequestReport?.reportID);
const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID ?? '-1'}`, {selector: ReportUtils.getArchiveReason});
const isArchivedReport = ReportUtils.isArchivedReport(moneyRequestReport);
const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID}`, {selector: ReportUtils.getArchiveReason});

const getCanIOUBePaid = useCallback(
(onlyShowPayElsewhere = false) => IOU.canIOUBePaid(moneyRequestReport, chatReport, policy, transaction ? [transaction] : undefined, onlyShowPayElsewhere),
Expand All @@ -131,8 +131,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const onlyShowPayElsewhere = useMemo(() => !canIOUBePaid && getCanIOUBePaid(true), [canIOUBePaid, getCanIOUBePaid]);

const shouldShowMarkAsCashButton =
hasAllPendingRTERViolations ||
(shouldShowBrokenConnectionViolation && (!PolicyUtils.isPolicyAdmin(policy) || ReportUtils.isCurrentUserSubmitter(moneyRequestReport?.reportID ?? '')));
hasAllPendingRTERViolations || (shouldShowBrokenConnectionViolation && (!PolicyUtils.isPolicyAdmin(policy) || ReportUtils.isCurrentUserSubmitter(moneyRequestReport?.reportID)));

const shouldShowPayButton = canIOUBePaid || onlyShowPayElsewhere;

Expand All @@ -145,6 +144,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea

const shouldShowSubmitButton =
!!moneyRequestReport &&
!isArchivedReport &&
isDraft &&
reimbursableSpend !== 0 &&
!hasAllPendingRTERViolations &&
Expand Down Expand Up @@ -215,10 +215,10 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const deleteTransaction = useCallback(() => {
if (requestParentReportAction) {
const iouTransactionID = ReportActionsUtils.isMoneyRequestAction(requestParentReportAction)
? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID ?? '-1'
: '-1';
? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID
: undefined;
if (ReportActionsUtils.isTrackExpenseAction(requestParentReportAction)) {
navigateBackToAfterDelete.current = IOU.deleteTrackExpense(moneyRequestReport?.reportID ?? '-1', iouTransactionID, requestParentReportAction, true);
navigateBackToAfterDelete.current = IOU.deleteTrackExpense(moneyRequestReport?.reportID, iouTransactionID, requestParentReportAction, true);
} else {
navigateBackToAfterDelete.current = IOU.deleteMoneyRequest(iouTransactionID, requestParentReportAction, true);
}
Expand All @@ -232,10 +232,13 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
return;
}
const iouTransactionID = ReportActionsUtils.isMoneyRequestAction(requestParentReportAction)
? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID ?? '-1'
: '-1';
const reportID = transactionThreadReport?.reportID ?? '-1';
? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID
: undefined;
const reportID = transactionThreadReport?.reportID;

if (!iouTransactionID || !reportID) {
return;
}
TransactionActions.markAsCash(iouTransactionID, reportID);
}, [requestParentReportAction, transactionThreadReport?.reportID]);

Expand Down Expand Up @@ -265,7 +268,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
icon: getStatusIcon(Expensicons.Hourglass),
description: (
<BrokenConnectionDescription
transactionID={transaction?.transactionID ?? '-1'}
transactionID={transaction?.transactionID}
report={moneyRequestReport}
policy={policy}
/>
Expand Down Expand Up @@ -354,7 +357,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
text={translate('iou.reviewDuplicates')}
style={styles.p0}
onPress={() => {
Navigation.navigate(ROUTES.TRANSACTION_DUPLICATE_REVIEW_PAGE.getRoute(transactionThreadReportID ?? '', Navigation.getReportRHPActiveRoute()));
Navigation.navigate(ROUTES.TRANSACTION_DUPLICATE_REVIEW_PAGE.getRoute(transactionThreadReportID, Navigation.getReportRHPActiveRoute()));
}}
/>
</View>
Expand Down Expand Up @@ -422,7 +425,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
text={translate('iou.reviewDuplicates')}
style={[styles.flex1, styles.pr0]}
onPress={() => {
Navigation.navigate(ROUTES.TRANSACTION_DUPLICATE_REVIEW_PAGE.getRoute(transactionThreadReportID ?? '', Navigation.getReportRHPActiveRoute()));
Navigation.navigate(ROUTES.TRANSACTION_DUPLICATE_REVIEW_PAGE.getRoute(transactionThreadReportID, Navigation.getReportRHPActiveRoute()));
}}
/>
)}
Expand Down
9 changes: 5 additions & 4 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
hasWarningTypeViolations,
isAllowedToApproveExpenseReport,
isAllowedToSubmitDraftExpenseReport,
isArchivedRoomWithID,
isArchivedReport,
isInvoiceReport as isInvoiceReportUtils,
isInvoiceRoom as isInvoiceRoomReportUtils,
isOpenExpenseReport as isOpenExpenseReportUtils,
Expand Down Expand Up @@ -242,10 +242,12 @@ function ReportPreview({
formattedMerchant = null;
}

const isArchived = isArchivedReport(iouReport);
const currentUserAccountID = getCurrentUserAccountID();
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
const shouldShowSubmitButton =
isOpenExpenseReport &&
!isArchived &&
reimbursableSpend !== 0 &&
!showRTERViolationMessage &&
!shouldShowBrokenConnectionViolation &&
Expand Down Expand Up @@ -426,15 +428,14 @@ function ReportPreview({
const shouldShowPendingSubtitle = numberOfPendingRequests === 1 && numberOfRequests === 1;

const isPayAtEndExpense = isPayAtEndExpenseReport(iouReportID, allTransactions);
const isArchivedReport = isArchivedRoomWithID(iouReportID);
const [archiveReason] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, {selector: getArchiveReason});

const getPendingMessageProps: () => PendingMessageProps = () => {
if (isPayAtEndExpense) {
if (!isArchivedReport) {
if (!isArchived) {
return {shouldShow: true, messageIcon: Expensicons.Hourglass, messageDescription: translate('iou.bookingPending')};
}
if (isArchivedReport && archiveReason === CONST.REPORT.ARCHIVE_REASON.BOOKING_END_DATE_HAS_PASSED) {
if (isArchived && archiveReason === CONST.REPORT.ARCHIVE_REASON.BOOKING_END_DATE_HAS_PASSED) {
return {
shouldShow: true,
messageIcon: Expensicons.Box,
Expand Down
Loading
Loading