@@ -66,7 +66,7 @@ import type ReportAction from '@src/types/onyx/ReportAction';
6666import type { OnyxData } from '@src/types/onyx/Request' ;
6767import type { Receipt , TransactionChanges , TransactionCustomUnit , WaypointCollection } from '@src/types/onyx/Transaction' ;
6868import { isEmptyObject } from '@src/types/utils/EmptyObject' ;
69- import { getAllPersonalDetails , getAllReportActionsFromIOU , getAllReportNameValuePairs , getAllReports , getCurrentUserPersonalDetails , getUserAccountID } from './index' ;
69+ import { getAllPersonalDetails , getAllReportActionsFromIOU , getAllReportNameValuePairs , getAllReports , getCurrentUserPersonalDetails } from './index' ;
7070import type { ReplaceReceipt } from './Receipt' ;
7171import { getSearchOnyxUpdate } from './SearchUpdate' ;
7272import type { StartSplitBilActionParams } from './Split' ;
@@ -261,6 +261,7 @@ type BuildOnyxDataForTestDriveIOUParams = {
261261 iouOptimisticParams : MoneyRequestOptimisticParams [ 'iou' ] ;
262262 chatOptimisticParams : MoneyRequestOptimisticParams [ 'chat' ] ;
263263 testDriveCommentReportActionID ?: string ;
264+ currentUserAccountIDParam : number ;
264265} ;
265266
266267function buildMinimalTransactionForFormula (
@@ -323,8 +324,6 @@ function getReceiptError(
323324function buildOnyxDataForTestDriveIOU (
324325 testDriveIOUParams : BuildOnyxDataForTestDriveIOUParams ,
325326) : OnyxData < typeof ONYXKEYS . COLLECTION . REPORT_ACTIONS | typeof ONYXKEYS . COLLECTION . REPORT | typeof ONYXKEYS . COLLECTION . TRANSACTION_DRAFT > {
326- const deprecatedUserAccountID = getUserAccountID ( ) ;
327- const deprecatedCurrentUserPersonalDetails = getCurrentUserPersonalDetails ( ) ;
328327 const optimisticData : Array < OnyxUpdate < typeof ONYXKEYS . COLLECTION . REPORT_ACTIONS | typeof ONYXKEYS . COLLECTION . REPORT > > = [ ] ;
329328 const successData : Array < OnyxUpdate < typeof ONYXKEYS . COLLECTION . REPORT_ACTIONS | typeof ONYXKEYS . COLLECTION . REPORT > > = [ ] ;
330329 const failureData : Array < OnyxUpdate < typeof ONYXKEYS . COLLECTION . REPORT_ACTIONS | typeof ONYXKEYS . COLLECTION . REPORT | typeof ONYXKEYS . COLLECTION . TRANSACTION_DRAFT > > = [ ] ;
@@ -340,11 +339,11 @@ function buildOnyxDataForTestDriveIOU(
340339 transactionID : testDriveIOUParams . transaction . transactionID ,
341340 reportActionID : testDriveIOUParams . iouOptimisticParams . action . reportActionID ,
342341 } ) ;
343- const text = translateLocal ( 'testDrive.employeeInviteMessage' , getAllPersonalDetails ( ) ?. [ deprecatedUserAccountID ] ?. firstName ?? '' ) ;
342+ const text = translateLocal ( 'testDrive.employeeInviteMessage' , getAllPersonalDetails ( ) ?. [ testDriveIOUParams . currentUserAccountIDParam ] ?. firstName ?? '' ) ;
344343 // delegateAccountIDParam: will be threaded in PR 15; buildOptimisticAddCommentReportAction falls back to module-level Onyx.connect value (https://github.com/Expensify/App/issues/66425)
345344 const textComment = buildOptimisticAddCommentReportAction ( {
346345 text,
347- actorAccountID : deprecatedUserAccountID ,
346+ actorAccountID : testDriveIOUParams . currentUserAccountIDParam ,
348347 reportActionID : testDriveIOUParams . testDriveCommentReportActionID ,
349348 delegateAccountIDParam : undefined ,
350349 } ) ;
@@ -364,7 +363,7 @@ function buildOnyxDataForTestDriveIOU(
364363 value : {
365364 ...{ lastActionType : CONST . REPORT . ACTIONS . TYPE . MARKED_REIMBURSED , statusNum : CONST . REPORT . STATUS_NUM . REIMBURSED } ,
366365 hasOutstandingChildRequest : false ,
367- lastActorAccountID : deprecatedCurrentUserPersonalDetails ?. accountID ,
366+ lastActorAccountID : testDriveIOUParams . currentUserAccountIDParam ,
368367 } ,
369368 } ,
370369 {
@@ -618,6 +617,7 @@ function buildOnyxDataForMoneyRequest(moneyRequestParams: BuildOnyxDataForMoneyR
618617 iouOptimisticParams : iou ,
619618 chatOptimisticParams : chat ,
620619 testDriveCommentReportActionID,
620+ currentUserAccountIDParam,
621621 } ) ;
622622 onyxData . optimisticData ?. push ( ...testDriveOptimisticData ) ;
623623 onyxData . successData ?. push ( ...testDriveSuccessData ) ;
0 commit comments