Skip to content
Merged
1 change: 1 addition & 0 deletions src/libs/IOUAmountSubmission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ function submitAmount({
isSelfTourViewed,
optimisticChatReportID,
optimisticTransactionID,
reportActionsList: undefined,
});
} else {
const existingTransactionDraft = existingTransactionID ? transactionDrafts?.[existingTransactionID] : undefined;
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/IOU/Duplicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ function duplicateExpenseTransaction({
betas,
isSelfTourViewed,
currentUserLocalCurrency,
reportActionsList: undefined,
};
return trackExpense(trackExpenseParams);
}
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/IOU/MoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ function createTransaction({
optimisticChatReportID,
optimisticTransactionID,
currentUserLocalCurrency,
reportActionsList: undefined,
});
} else {
const existingTransactionID = getExistingTransactionID(transaction?.linkedTrackedExpenseReportAction);
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU/TrackExpense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2280,8 +2280,6 @@ function shareTrackedExpense(trackedExpenseParams: TrackedExpenseParams) {
formatPhoneNumber,
personalDetailsList,
{accountID: currentUserAccountID},
undefined,
undefined,
reportActionsList,
);
onyxData.optimisticData?.push(...addAccountantToWorkspaceOptimisticData);
Expand Down Expand Up @@ -2619,6 +2617,7 @@ function trackExpense(params: CreateTrackExpenseParams) {
policyParams,
createdWorkspaceParams,
currentUser: {accountID: currentUserAccountIDParam, email: currentUserEmailParam},
reportActionsList: reportActionsList ?? {},
};

categorizeTrackedExpense(trackedExpenseParams);
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU/types/CreateTrackExpenseParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ type CreateTrackExpenseParams = {
previousOdometerDraft?: OnyxEntry<OnyxTypes.OdometerDraft>;
// TODO: delegateAccountID will be made required in PR 10 when all callers pass the value (https://github.com/Expensify/App/issues/66425)
delegateAccountID?: number | undefined;
// TODO: Remove optional (?) once all callers are updated in follow-up PRs of https://github.com/Expensify/App/issues/66578
reportActionsList?: OnyxCollection<OnyxTypes.ReportActions>;
reportActionsList: OnyxCollection<OnyxTypes.ReportActions> | undefined;
// TODO: Remove optional (?) once all callers are updated in follow-up PRs of https://github.com/Expensify/App/issues/66414
isDraftChatReport?: boolean;
// Personal details list is optional here because we only use/pass it for SHARE case
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU/types/TrackedExpenseParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ type TrackedExpenseParams = {
createdWorkspaceParams?: CreateWorkspaceParams;
accountantParams?: TrackExpenseAccountantParams;
currentUser: CurrentUser;
// TODO: Remove optional (?) once all callers are updated in follow-up PRs of https://github.com/Expensify/App/issues/66578
reportActionsList?: OnyxCollection<OnyxTypes.ReportActions>;
reportActionsList: OnyxCollection<OnyxTypes.ReportActions>;
// Personal details list is optional here because we only use/pass it for SHARE case
personalDetailsList?: OnyxEntry<OnyxTypes.PersonalDetailsList>;
};
Expand Down
6 changes: 2 additions & 4 deletions src/libs/actions/Policy/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,9 @@ function buildAddMembersToWorkspaceOnyxData(
formatPhoneNumber: LocaleContextProps['formatPhoneNumber'],
personalDetailsList: OnyxEntry<PersonalDetailsList>,
currentUser: CurrentUser,
reportActionsList: OnyxCollection<ReportActions> | undefined,
approverEmail?: string,
policyExpenseChatNotificationPreference?: NotificationPreference,
// TODO: Remove optional (?) once all callers are updated in follow-up PRs of https://github.com/Expensify/App/issues/66578
reportActionsList?: OnyxCollection<ReportActions>,
) {
const policyID = policy.id;
const logins = Object.keys(invitedEmailsToAccountIDs).map((memberLogin) => PhoneNumber.addSMSDomainIfPhoneNumber(memberLogin));
Expand Down Expand Up @@ -982,9 +981,8 @@ function addMembersToWorkspace(
formatPhoneNumber,
personalDetailsList,
currentUser,
approverEmail,
undefined,
reportActionsList,
approverEmail,
);

const params: AddMembersToWorkspaceParams = {
Expand Down
11 changes: 1 addition & 10 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,6 @@ type SetWorkspaceApprovalModeAdditionalData = {
betas?: Beta[];
};

let deprecatedAllReportActions: OnyxCollection<ReportActions>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
deprecatedAllReportActions = actions;
},
});

let deprecatedAllPersonalDetails: OnyxEntry<PersonalDetailsList>;
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
Expand Down Expand Up @@ -1646,7 +1637,7 @@ function createPolicyExpenseChats({
},
});
const currentTime = DateUtils.getDBTime();
const reportActions = (reportActionsList ?? deprecatedAllReportActions)?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${oldChat.reportID}`] ?? {};
const reportActions = reportActionsList?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${oldChat.reportID}`] ?? {};
Comment thread
DylanDylann marked this conversation as resolved.
for (const action of Object.values(reportActions)) {
if (action.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Report/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7789,9 +7789,9 @@ function changeReportPolicyAndInviteSubmitter({
formatPhoneNumber,
personalDetails,
currentUser,
reportActionsList,
undefined,
CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS,
reportActionsList,
);
const optimisticPolicyExpenseChatReportID = membersChats.reportCreationData[submitterLogin].reportID;
const optimisticPolicyExpenseChatCreatedReportActionID = membersChats.reportCreationData[submitterLogin].reportActionID;
Expand Down
1 change: 1 addition & 0 deletions src/pages/Share/SubmitDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ function SubmitDetailsPage({
isSelfTourViewed,
optimisticTransactionID,
currentUserLocalCurrency: currentUserPersonalDetails.localCurrencyCode ?? CONST.CURRENCY.USD,
reportActionsList: undefined,
});
} else {
const existingTransactionDraft = existingTransactionID ? transactionDrafts?.[existingTransactionID] : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ function handleMoneyRequestStepDistanceNavigation({
optimisticTransactionID,
optimisticChatReportID,
currentUserLocalCurrency,
reportActionsList: undefined,
});
cleanupAfterSkipConfirmSubmit(overrides.shouldHandleNavigation, {
report,
Expand Down
4 changes: 4 additions & 0 deletions tests/actions/IOU/RequestMoneyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,7 @@ describe('actions/IOU', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});

mockFetch?.resume?.();
Expand Down Expand Up @@ -1357,6 +1358,7 @@ describe('actions/IOU', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -1881,6 +1883,7 @@ describe('actions/IOU', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -2604,6 +2607,7 @@ describe('actions/IOU', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});

await waitForBatchedUpdates();
Expand Down
19 changes: 19 additions & 0 deletions tests/actions/IOUTest/TrackExpenseTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -332,6 +333,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();
await mockFetch?.resume?.();
Expand Down Expand Up @@ -440,6 +442,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();
await mockFetch?.resume?.();
Expand Down Expand Up @@ -530,6 +533,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -584,6 +588,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -666,6 +671,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -720,6 +726,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -806,6 +813,7 @@ describe('actions/IOU/TrackExpense', () => {
draftTransactionIDs: [transaction.transactionID],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -860,6 +868,7 @@ describe('actions/IOU/TrackExpense', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -944,6 +953,7 @@ describe('actions/IOU/TrackExpense', () => {
draftTransactionIDs: [transaction.transactionID],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -998,6 +1008,7 @@ describe('actions/IOU/TrackExpense', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -1101,6 +1112,7 @@ describe('actions/IOU/TrackExpense', () => {
draftTransactionIDs: [transaction.transactionID],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -1219,6 +1231,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
};
}

Expand Down Expand Up @@ -1442,6 +1455,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -1532,6 +1546,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -1870,6 +1885,7 @@ describe('actions/IOU/TrackExpense', () => {
...getDefaultTrackExpenseParams(selfDMReport, {amount: 12000, merchant: 'Tour Viewed Merchant'}),
isSelfTourViewed: true,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -1903,6 +1919,7 @@ describe('actions/IOU/TrackExpense', () => {
...getDefaultTrackExpenseParams(selfDMReport, {amount: 9000, merchant: 'Tour Not Viewed Merchant'}),
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -2346,6 +2363,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down Expand Up @@ -2650,6 +2668,7 @@ describe('actions/IOU/TrackExpense', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down
1 change: 1 addition & 0 deletions tests/actions/PolicyMemberTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ describe('actions/PolicyMember', () => {
TestHelper.formatPhoneNumber,
undefined,
currentUserInput,
undefined,
);

type BuildResult = ReturnType<typeof buildForCurrentUser>;
Expand Down
21 changes: 18 additions & 3 deletions tests/actions/PolicyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5904,7 +5904,12 @@ describe('actions/Policy', () => {
await waitForBatchedUpdates();

// When creating policy expense chats for a new member
const result = Policy.createPolicyExpenseChats({policyID, invitedEmailsToAccountIDs: {[newMemberEmail]: newMemberAccountID}, currentUser: {accountID: ESH_ACCOUNT_ID}});
const result = Policy.createPolicyExpenseChats({
policyID,
invitedEmailsToAccountIDs: {[newMemberEmail]: newMemberAccountID},
currentUser: {accountID: ESH_ACCOUNT_ID},
reportActionsList: {},
});

// Then optimistic data should be generated
expect(result.onyxOptimisticData.length).toBeGreaterThan(0);
Expand Down Expand Up @@ -5962,7 +5967,12 @@ describe('actions/Policy', () => {
await waitForBatchedUpdates();

// When creating policy expense chats for the existing member
const result = Policy.createPolicyExpenseChats({policyID, invitedEmailsToAccountIDs: {[existingMemberEmail]: existingMemberAccountID}, currentUser: {accountID: ESH_ACCOUNT_ID}});
const result = Policy.createPolicyExpenseChats({
policyID,
invitedEmailsToAccountIDs: {[existingMemberEmail]: existingMemberAccountID},
currentUser: {accountID: ESH_ACCOUNT_ID},
reportActionsList: {},
});

// Then the existing report should be reused (no new reportActionID)
const reportCreationEntry = result.reportCreationData[existingMemberEmail];
Expand All @@ -5981,7 +5991,12 @@ describe('actions/Policy', () => {
const newMemberAccountID = 200;
const customAccountID = 999;

const result = Policy.createPolicyExpenseChats({policyID, invitedEmailsToAccountIDs: {[newMemberEmail]: newMemberAccountID}, currentUser: {accountID: customAccountID}});
const result = Policy.createPolicyExpenseChats({
policyID,
invitedEmailsToAccountIDs: {[newMemberEmail]: newMemberAccountID},
currentUser: {accountID: customAccountID},
reportActionsList: {},
});

// Find the optimistic report data
const reportCreationEntry = result.reportCreationData[newMemberEmail];
Expand Down
1 change: 1 addition & 0 deletions tests/actions/TransactionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ describe('actions/Transaction', () => {
draftTransactionIDs: [],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await getOnyxData({
key: ONYXKEYS.COLLECTION.TRANSACTION,
Expand Down
1 change: 1 addition & 0 deletions tests/ui/UnreadIndicatorsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ describe('Unread Indicators', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});
await waitForBatchedUpdates();

Expand Down
1 change: 1 addition & 0 deletions tests/unit/GoogleTagManagerTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ describe('GoogleTagManagerTest', () => {
betas: [CONST.BETAS.ALL],
isSelfTourViewed: false,
currentUserLocalCurrency: undefined,
reportActionsList: undefined,
});

await waitForBatchedUpdatesWithAct();
Expand Down
Loading