@@ -1580,12 +1580,20 @@ function hasOnlyNonReimbursableTransactions(iouReportID: string | undefined): bo
1580
1580
return transactions . every ( ( transaction ) => ! TransactionUtils . getReimbursable ( transaction ) ) ;
1581
1581
}
1582
1582
1583
+ /**
1584
+ * Checks if a report has only transactions with same ownerID
1585
+ */
1586
+ function isSingleActorMoneyReport ( reportID : string ) : boolean {
1587
+ const reportActions = allReportActions ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ] ?? ( [ ] as ReportAction [ ] ) ;
1588
+ return ! ! ReportActionsUtils . hasSameActorForAllTransactions ( reportID , reportActions ) ;
1589
+ }
1590
+
1583
1591
/**
1584
1592
* Checks if a report has only one transaction associated with it
1585
1593
*/
1586
1594
function isOneTransactionReport ( reportID : string ) : boolean {
1587
1595
const reportActions = allReportActions ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ reportID } ` ] ?? ( [ ] as ReportAction [ ] ) ;
1588
- return ReportActionsUtils . getOneTransactionThreadReportID ( reportID , reportActions ) !== null ;
1596
+ return ! ! ReportActionsUtils . getOneTransactionThreadReportID ( reportID , reportActions ) ;
1589
1597
}
1590
1598
1591
1599
/*
@@ -2217,7 +2225,7 @@ function getIcons(
2217
2225
if ( isChatThread ( report ) ) {
2218
2226
const parentReportAction = allReportActions ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ report . parentReportID } ` ] ?. [ report . parentReportActionID ] ;
2219
2227
2220
- const actorAccountID = getReportActionActorAccountID ( parentReportAction , report ) ;
2228
+ const actorAccountID = getReportActionActorAccountID ( parentReportAction ) ;
2221
2229
const actorDisplayName = PersonalDetailsUtils . getDisplayNameOrDefault ( allPersonalDetails ?. [ actorAccountID ?? - 1 ] , '' , false ) ;
2222
2230
const actorIcon = {
2223
2231
id : actorAccountID ,
@@ -2312,7 +2320,7 @@ function getIcons(
2312
2320
const isManager = currentUserAccountID === report ?. managerID ;
2313
2321
2314
2322
// For one transaction IOUs, display a simplified report icon
2315
- if ( isOneTransactionReport ( report ?. reportID ?? '-1' ) ) {
2323
+ if ( isOneTransactionReport ( report ?. reportID ?? '-1' ) || isSingleActorMoneyReport ( report ?. reportID ?? '-1' ) ) {
2316
2324
return [ ownerIcon ] ;
2317
2325
}
2318
2326
@@ -4826,9 +4834,9 @@ function buildOptimisticReportPreview(
4826
4834
} ,
4827
4835
] ,
4828
4836
created,
4829
- accountID : iouReport ?. managerID ?? - 1 ,
4837
+ accountID : iouReport ?. ownerAccountID ?? - 1 ,
4830
4838
// The preview is initially whispered if created with a receipt, so the actor is the current user as well
4831
- actorAccountID : hasReceipt ? currentUserAccountID : iouReport ?. managerID ?? - 1 ,
4839
+ actorAccountID : hasReceipt ? currentUserAccountID : iouReport ?. ownerAccountID ?? - 1 ,
4832
4840
childReportID : childReportID ?? iouReport ?. reportID ,
4833
4841
childMoneyRequestCount : 1 ,
4834
4842
childLastMoneyRequestComment : comment ,
@@ -6649,7 +6657,7 @@ function shouldReportShowSubscript(report: OnyxEntry<Report>): boolean {
6649
6657
return true ;
6650
6658
}
6651
6659
6652
- if ( isExpenseReport ( report ) && isOneTransactionReport ( report ?. reportID ?? '-1' ) ) {
6660
+ if ( isExpenseReport ( report ) ) {
6653
6661
return true ;
6654
6662
}
6655
6663
@@ -6661,7 +6669,7 @@ function shouldReportShowSubscript(report: OnyxEntry<Report>): boolean {
6661
6669
return true ;
6662
6670
}
6663
6671
6664
- if ( isInvoiceRoom ( report ) ) {
6672
+ if ( isInvoiceRoom ( report ) || isInvoiceReport ( report ) ) {
6665
6673
return true ;
6666
6674
}
6667
6675
@@ -7543,10 +7551,10 @@ function canLeaveChat(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>): boo
7543
7551
return ( isChatThread ( report ) && ! ! getReportNotificationPreference ( report ) ) || isUserCreatedPolicyRoom ( report ) || isNonAdminOrOwnerOfPolicyExpenseChat ( report , policy ) ;
7544
7552
}
7545
7553
7546
- function getReportActionActorAccountID ( reportAction : OnyxInputOrEntry < ReportAction > , iouReport : OnyxInputOrEntry < Report > | undefined ) : number | undefined {
7554
+ function getReportActionActorAccountID ( reportAction : OnyxInputOrEntry < ReportAction > ) : number | undefined {
7547
7555
switch ( reportAction ?. actionName ) {
7548
7556
case CONST . REPORT . ACTIONS . TYPE . REPORT_PREVIEW :
7549
- return ! isEmptyObject ( iouReport ) ? iouReport . managerID : reportAction ?. childManagerAccountID ;
7557
+ return reportAction ?. childOwnerAccountID ?? reportAction ?. actorAccountID ;
7550
7558
7551
7559
case CONST . REPORT . ACTIONS . TYPE . SUBMITTED :
7552
7560
return reportAction ?. adminAccountID ?? reportAction ?. actorAccountID ;
@@ -8127,6 +8135,7 @@ export {
8127
8135
isIndividualInvoiceRoom ,
8128
8136
isAuditor ,
8129
8137
hasMissingInvoiceBankAccount ,
8138
+ isSingleActorMoneyReport ,
8130
8139
} ;
8131
8140
8132
8141
export type {
0 commit comments