@@ -1333,6 +1333,28 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
13331333 ) ;
13341334 } , [ selectedTransactionReportIDs , currentUserPersonalDetails ?. accountID , currentSearchResults ?. data , allReports ] ) ;
13351335
1336+ const areAllTransactionsFromDMReports = useMemo ( ( ) => {
1337+ const searchData = currentSearchResults ?. data ;
1338+ const reports : Report [ ] = searchData
1339+ ? Object . keys ( searchData )
1340+ . filter ( ( key ) => key . startsWith ( ONYXKEYS . COLLECTION . REPORT ) )
1341+ . map ( ( key ) => searchData [ key as keyof typeof searchData ] as Report )
1342+ . filter ( ( report ) : report is Report => report != null && 'reportID' in report )
1343+ : [ ] ;
1344+
1345+ return (
1346+ selectedTransactionReportIDs . length > 0 &&
1347+ selectedTransactionReportIDs . every ( ( id ) => {
1348+ const iouReport = getReportOrDraftReport ( id , reports , undefined , undefined , allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ id } ` ] ) ;
1349+ if ( ! iouReport ?. chatReportID ) {
1350+ return false ;
1351+ }
1352+ const chatReport = allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ iouReport . chatReportID } ` ] ;
1353+ return isDM ( chatReport ) ;
1354+ } )
1355+ ) ;
1356+ } , [ selectedTransactionReportIDs , currentSearchResults ?. data , allReports ] ) ;
1357+
13361358 const duplicateHandlerRef = useRef < ( ) => void > ( ( ) => { } ) ;
13371359 const setDuplicateHandler = useCallback ( ( handler : ( ) => void ) => {
13381360 duplicateHandlerRef . current = handler ;
@@ -2286,6 +2308,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
22862308 isOfflineModalVisible,
22872309 isDownloadErrorModalVisible,
22882310 isHoldEducationalModalVisible,
2311+ areAllTransactionsFromDMReports,
22892312 rejectModalAction,
22902313 emptyReportsCount,
22912314 handleOfflineModalClose,
0 commit comments