Skip to content

Commit 5f76e42

Browse files
committed
Merge branch 'main' of https://github.com/Expensify/App into fix/67609
2 parents a24a007 + e7245a3 commit 5f76e42

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/components/MoneyRequestConfirmationListFooter.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import DistanceRequestUtils from '@libs/DistanceRequestUtils';
1515
import {isMovingTransactionFromTrackExpense} from '@libs/IOUUtils';
1616
import Navigation from '@libs/Navigation/Navigation';
1717
import {getDestinationForDisplay, getSubratesFields, getSubratesForDisplay, getTimeDifferenceIntervals, getTimeForDisplay} from '@libs/PerDiemRequestUtils';
18-
import {canSendInvoice, getPerDiemCustomUnit} from '@libs/PolicyUtils';
18+
import {canSendInvoice, getPerDiemCustomUnit, isPaidGroupPolicy} from '@libs/PolicyUtils';
1919
import type {ThumbnailAndImageURI} from '@libs/ReceiptUtils';
2020
import {getThumbnailAndImageURIs} from '@libs/ReceiptUtils';
2121
import {
@@ -332,7 +332,12 @@ function MoneyRequestConfirmationListFooter({
332332
// Determine if the merchant error should be displayed
333333
const shouldDisplayMerchantError = isMerchantRequired && (shouldDisplayFieldError || formError === 'iou.error.invalidMerchant') && isMerchantEmpty;
334334
const shouldDisplayDistanceRateError = formError === 'iou.error.invalidRate';
335-
const shouldShowReceiptEmptyState = (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK) && !isPerDiemRequest && !isMovingTransactionFromTrackExpense(action);
335+
// Determine when to show the receipt empty state:
336+
// - Show for submit or track expense types
337+
// - Hide for per diem requests
338+
// - Hide when submitting a track expense to a non-paid group policy (personal users)
339+
const shouldShowReceiptEmptyState =
340+
(iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK) && !isPerDiemRequest && (!isMovingTransactionFromTrackExpense(action) || isPaidGroupPolicy(policy));
336341
// The per diem custom unit
337342
const perDiemCustomUnit = getPerDiemCustomUnit(policy);
338343
const {

src/libs/actions/IOU.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,7 @@ function buildOnyxDataForTrackExpense({
25332533
onyxMethod: Onyx.METHOD.MERGE,
25342534
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
25352535
value: {
2536+
lastReadTime: actionableTrackExpenseWhisper.created,
25362537
lastVisibleActionCreated: actionableTrackExpenseWhisper.created,
25372538
lastMessageText: CONST.ACTIONABLE_TRACK_EXPENSE_WHISPER_MESSAGE,
25382539
},

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Much of the logic in the app is asynchronous in nature. [`react-native-onyx`](https://github.com/expensify/react-native-onyx) writes data async before updating subscribers.
88
- [Actions](https://github.com/Expensify/App#actions) do not typically return a `Promise` and therefore can't always be "awaited" before running an assertion.
99
- To test a result after some asynchronous code has run we can use [`Onyx.connect()`](https://github.com/Expensify/react-native-onyx/blob/2c94a94e51fab20330f7bd5381b72ea6c25553d9/lib/Onyx.js#L217-L231) and the helper method [`waitForBatchedUpdates()`](https://github.com/Expensify/ReactNativeChat/blob/ca2fa88a5789b82463d35eddc3d57f70a7286868/tests/utils/waitForBatchedUpdates.js#L1-L9) which returns a `Promise` and will ensure that all other `Promises` have finished running before resolving.
10-
- **Important Note:** When writing any asynchronous Jest test it's very important that your test itself **return a `Promise`**.
10+
- **Important Note:** When writing any asynchronous Jest test it's very important that your test itself **return a `Promise`**. In hooks like BeforeEach, BeforeAll, AfterAll, etc., you also need to return a promise or use async/await if they perform any asynchronous calls.
1111

1212
## Mocking Network Requests
1313

tests/ui/UnreadIndicatorsTest.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,12 @@ describe('Unread Indicators', () => {
187187

188188
beforeEach(() => {
189189
jest.clearAllMocks();
190-
Onyx.clear();
191190

191+
global.fetch = TestHelper.getGlobalFetchMock();
192192
// Unsubscribe to pusher channels
193193
PusherHelper.teardown();
194+
195+
return Onyx.clear().then(waitForBatchedUpdates);
194196
});
195197

196198
it('Display bold in the LHN for unread chat and new line indicator above the chat message when we navigate to it', () =>

0 commit comments

Comments
 (0)