@@ -1114,22 +1114,22 @@ function getMoneyRequestInformation(
1114
1114
// 4. The transaction thread, which requires the iouAction, and CREATED action for the transaction thread
1115
1115
// 5. REPORTPREVIEW action for the chatReport
1116
1116
// Note: The CREATED action for the IOU report must be optimistically generated before the IOU action so there's no chance that it appears after the IOU action in the chat
1117
- const optimisticCreatedActionForChat = ReportUtils . buildOptimisticCreatedReportAction ( payeeEmail ) ;
1118
- const [ optimisticCreatedActionForIOUReport , iouAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] = ReportUtils . buildOptimisticMoneyRequestEntities (
1119
- iouReport ,
1120
- CONST . IOU . REPORT_ACTION_TYPE . CREATE ,
1121
- amount ,
1122
- currency ,
1123
- comment ,
1124
- payeeEmail ,
1125
- [ participant ] ,
1126
- optimisticTransaction . transactionID ,
1127
- undefined ,
1128
- false ,
1129
- false ,
1130
- receiptObject ,
1131
- false ,
1132
- ) ;
1117
+ const [ optimisticCreatedActionForChat , optimisticCreatedActionForIOUReport , iouAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] =
1118
+ ReportUtils . buildOptimisticMoneyRequestEntities (
1119
+ iouReport ,
1120
+ CONST . IOU . REPORT_ACTION_TYPE . CREATE ,
1121
+ amount ,
1122
+ currency ,
1123
+ comment ,
1124
+ payeeEmail ,
1125
+ [ participant ] ,
1126
+ optimisticTransaction . transactionID ,
1127
+ undefined ,
1128
+ false ,
1129
+ false ,
1130
+ receiptObject ,
1131
+ false ,
1132
+ ) ;
1133
1133
1134
1134
let reportPreviewAction = shouldCreateNewMoneyRequestReport ? null : ReportActionsUtils . getReportPreviewAction ( chatReport . reportID , iouReport . reportID ) ;
1135
1135
if ( reportPreviewAction ) {
@@ -2522,17 +2522,17 @@ function createSplitsAndOnyxData(
2522
2522
// 3. IOU action for the iouReport
2523
2523
// 4. Transaction Thread and the CREATED action for it
2524
2524
// 5. REPORTPREVIEW action for the chatReport
2525
- const oneOnOneCreatedActionForChat = ReportUtils . buildOptimisticCreatedReportAction ( currentUserEmailForIOUSplit ) ;
2526
- const [ oneOnOneCreatedActionForIOU , oneOnOneIOUAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] = ReportUtils . buildOptimisticMoneyRequestEntities (
2527
- oneOnOneIOUReport ,
2528
- CONST . IOU . REPORT_ACTION_TYPE . CREATE ,
2529
- splitAmount ,
2530
- currency ,
2531
- comment ,
2532
- currentUserEmailForIOUSplit ,
2533
- [ participant ] ,
2534
- oneOnOneTransaction . transactionID ,
2535
- ) ;
2525
+ const [ oneOnOneCreatedActionForChat , oneOnOneCreatedActionForIOU , oneOnOneIOUAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] =
2526
+ ReportUtils . buildOptimisticMoneyRequestEntities (
2527
+ oneOnOneIOUReport ,
2528
+ CONST . IOU . REPORT_ACTION_TYPE . CREATE ,
2529
+ splitAmount ,
2530
+ currency ,
2531
+ comment ,
2532
+ currentUserEmailForIOUSplit ,
2533
+ [ participant ] ,
2534
+ oneOnOneTransaction . transactionID ,
2535
+ ) ;
2536
2536
2537
2537
// Add optimistic personal details for new participants
2538
2538
const oneOnOnePersonalDetailListAction : OnyxTypes . PersonalDetailsList = shouldCreateOptimisticPersonalDetails
@@ -3173,18 +3173,18 @@ function completeSplitBill(chatReportID: string, reportAction: OnyxTypes.ReportA
3173
3173
updatedTransaction . billable ,
3174
3174
) ;
3175
3175
3176
- const oneOnOneCreatedActionForChat = ReportUtils . buildOptimisticCreatedReportAction ( currentUserEmailForIOUSplit ) ;
3177
- const [ oneOnOneCreatedActionForIOU , oneOnOneIOUAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] = ReportUtils . buildOptimisticMoneyRequestEntities (
3178
- oneOnOneIOUReport ,
3179
- CONST . IOU . REPORT_ACTION_TYPE . CREATE ,
3180
- splitAmount ,
3181
- currency ?? '' ,
3182
- updatedTransaction . comment . comment ?? '' ,
3183
- currentUserEmailForIOUSplit ,
3184
- [ participant ] ,
3185
- oneOnOneTransaction . transactionID ,
3186
- undefined ,
3187
- ) ;
3176
+ const [ oneOnOneCreatedActionForChat , oneOnOneCreatedActionForIOU , oneOnOneIOUAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] =
3177
+ ReportUtils . buildOptimisticMoneyRequestEntities (
3178
+ oneOnOneIOUReport ,
3179
+ CONST . IOU . REPORT_ACTION_TYPE . CREATE ,
3180
+ splitAmount ,
3181
+ currency ?? '' ,
3182
+ updatedTransaction . comment . comment ?? '' ,
3183
+ currentUserEmailForIOUSplit ,
3184
+ [ participant ] ,
3185
+ oneOnOneTransaction . transactionID ,
3186
+ undefined ,
3187
+ ) ;
3188
3188
3189
3189
let oneOnOneReportPreviewAction = ReportActionsUtils . getReportPreviewAction ( oneOnOneChatReport ?. reportID ?? '' , oneOnOneIOUReport ?. reportID ?? '' ) ;
3190
3190
if ( oneOnOneReportPreviewAction ) {
@@ -4070,7 +4070,7 @@ function getSendMoneyParams(
4070
4070
value : optimisticTransaction ,
4071
4071
} ;
4072
4072
4073
- const [ optimisticCreatedActionForIOUReport , optimisticIOUReportAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] =
4073
+ const [ optimisticCreatedActionForChat , optimisticCreatedActionForIOUReport , optimisticIOUReportAction , optimisticTransactionThread , optimisticCreatedActionForTransactionThread ] =
4074
4074
ReportUtils . buildOptimisticMoneyRequestEntities (
4075
4075
optimisticIOUReport ,
4076
4076
CONST . IOU . REPORT_ACTION_TYPE . PAY ,
@@ -4137,6 +4137,7 @@ function getSendMoneyParams(
4137
4137
onyxMethod : Onyx . METHOD . MERGE ,
4138
4138
key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ optimisticIOUReport . reportID } ` ,
4139
4139
value : {
4140
+ [ optimisticCreatedActionForIOUReport . reportActionID ] : optimisticCreatedActionForIOUReport ,
4140
4141
[ optimisticIOUReportAction . reportActionID ] : {
4141
4142
...( optimisticIOUReportAction as OnyxTypes . ReportAction ) ,
4142
4143
pendingAction : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
@@ -4269,7 +4270,7 @@ function getSendMoneyParams(
4269
4270
4270
4271
if ( optimisticChatReportActionsData . value ) {
4271
4272
// Add an optimistic created action to the optimistic chat reportActions data
4272
- optimisticChatReportActionsData . value [ optimisticCreatedActionForIOUReport . reportActionID ] = optimisticCreatedActionForIOUReport ;
4273
+ optimisticChatReportActionsData . value [ optimisticCreatedActionForChat . reportActionID ] = optimisticCreatedActionForChat ;
4273
4274
}
4274
4275
} else {
4275
4276
failureData . push ( {
@@ -4306,8 +4307,9 @@ function getSendMoneyParams(
4306
4307
paymentMethodType,
4307
4308
transactionID : optimisticTransaction . transactionID ,
4308
4309
newIOUReportDetails,
4309
- createdReportActionID : isNewChat ? optimisticCreatedActionForIOUReport . reportActionID : '0' ,
4310
+ createdReportActionID : isNewChat ? optimisticCreatedActionForChat . reportActionID : '0' ,
4310
4311
reportPreviewReportActionID : reportPreviewAction . reportActionID ,
4312
+ createdIOUReportActionID : optimisticCreatedActionForIOUReport . reportActionID ,
4311
4313
transactionThreadReportID : optimisticTransactionThread . reportID ,
4312
4314
createdReportActionIDForThread : optimisticCreatedActionForTransactionThread . reportActionID ,
4313
4315
} ,
0 commit comments