@@ -122,6 +122,7 @@ import {
122122 isInvoiceRoom ,
123123 isMoneyRequest ,
124124 isPolicyAdmin ,
125+ isUnread ,
125126 isAdminRoom as reportUtilsIsAdminRoom ,
126127 isAnnounceRoom as reportUtilsIsAnnounceRoom ,
127128 isChatReport as reportUtilsIsChatReport ,
@@ -659,6 +660,7 @@ function getLastMessageTextForReport({
659660 : undefined ;
660661 // For workspace chats, use the report title
661662 if ( reportUtilsIsPolicyExpenseChat ( report ) && ! isEmptyObject ( iouReport ) ) {
663+ // eslint-disable-next-line @typescript-eslint/no-deprecated
662664 lastMessageTextFromReport = formatReportLastMessageText ( getReportName ( iouReport ) ) ;
663665 } else {
664666 const reportPreviewMessage = getReportPreviewMessage (
@@ -917,7 +919,8 @@ function createOption(
917919 : getAlternateText ( result , { showChatPreviewLine, forcePolicyNamePreview} , ! ! result . private_isArchived , lastActorDetails ) ;
918920 reportName = showPersonalDetails
919921 ? getDisplayNameForParticipant ( { accountID : accountIDs . at ( 0 ) , formatPhoneNumber : formatPhoneNumberPhoneUtils } ) || formatPhoneNumberPhoneUtils ( personalDetail ?. login ?? '' )
920- : getReportName ( report ) ;
922+ : // eslint-disable-next-line @typescript-eslint/no-deprecated
923+ getReportName ( report ) ;
921924 } else {
922925 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
923926 reportName = getDisplayNameForParticipant ( { accountID : accountIDs . at ( 0 ) , formatPhoneNumber : formatPhoneNumberPhoneUtils } ) || formatPhoneNumberPhoneUtils ( personalDetail ?. login ?? '' ) ;
@@ -963,6 +966,7 @@ function getReportOption(participant: Participant, reportAttributesDerived?: Rep
963966 // eslint-disable-next-line @typescript-eslint/no-deprecated
964967 option . alternateText = translateLocal ( 'reportActionsView.yourSpace' ) ;
965968 } else if ( option . isInvoiceRoom ) {
969+ // eslint-disable-next-line @typescript-eslint/no-deprecated
966970 option . text = getReportName ( report ) ;
967971 // eslint-disable-next-line @typescript-eslint/no-deprecated
968972 option . alternateText = translateLocal ( 'workspace.common.invoices' ) ;
@@ -1012,6 +1016,7 @@ function getReportDisplayOption(report: OnyxEntry<Report>, unknownUserDetails: O
10121016 // eslint-disable-next-line @typescript-eslint/no-deprecated
10131017 option . alternateText = translateLocal ( 'reportActionsView.yourSpace' ) ;
10141018 } else if ( option . isInvoiceRoom ) {
1019+ // eslint-disable-next-line @typescript-eslint/no-deprecated
10151020 option . text = getReportName ( report ) ;
10161021 // eslint-disable-next-line @typescript-eslint/no-deprecated
10171022 option . alternateText = translateLocal ( 'workspace.common.invoices' ) ;
@@ -1822,6 +1827,7 @@ function prepareReportOptionsForDisplay(options: Array<SearchOption<Report>>, co
18221827 isPerDiemRequest = false ,
18231828 showRBR = true ,
18241829 shouldShowGBR = false ,
1830+ shouldUnreadBeBold = false ,
18251831 } = config ;
18261832
18271833 const validOptions : Array < SearchOption < Report > > = [ ] ;
@@ -1841,7 +1847,18 @@ function prepareReportOptionsForDisplay(options: Array<SearchOption<Report>>, co
18411847 */
18421848 const alternateText = getAlternateText ( option , { showChatPreviewLine, forcePolicyNamePreview} , ! ! option . private_isArchived ) ;
18431849 const isSelected = isReportSelected ( option , selectedOptions ) ;
1844- const isBold = shouldBoldTitleByDefault || shouldUseBoldText ( option ) ;
1850+
1851+ let isOptionUnread = option . isUnread ;
1852+ if ( shouldUnreadBeBold ) {
1853+ const chatReport = allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ report . chatReportID } ` ] ;
1854+ const oneTransactionThreadReportID =
1855+ report . type === CONST . REPORT . TYPE . IOU || report . type === CONST . REPORT . TYPE . EXPENSE || report . type === CONST . REPORT . TYPE . INVOICE
1856+ ? getOneTransactionThreadReportID ( report , chatReport , allSortedReportActions [ report . reportID ] )
1857+ : undefined ;
1858+ const oneTransactionThreadReport = oneTransactionThreadReportID ? allReports ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ oneTransactionThreadReportID } ` ] : undefined ;
1859+
1860+ isOptionUnread = isUnread ( report , oneTransactionThreadReport , ! ! option . private_isArchived ) && ! ! report . lastActorAccountID ;
1861+ }
18451862
18461863 let lastIOUCreationDate ;
18471864 // Add a field to sort the recent reports by the time of last IOU request for create actions
@@ -1862,11 +1879,13 @@ function prepareReportOptionsForDisplay(options: Array<SearchOption<Report>>, co
18621879 ...option ,
18631880 alternateText,
18641881 isSelected,
1865- isBold ,
1882+ isUnread : isOptionUnread ,
18661883 lastIOUCreationDate,
18671884 brickRoadIndicator : showRBR ? option . brickRoadIndicator : null ,
18681885 } ;
18691886
1887+ newReportOption . isBold = shouldBoldTitleByDefault || shouldUseBoldText ( newReportOption ) ;
1888+
18701889 if ( newReportOption . brickRoadIndicator === CONST . BRICK_ROAD_INDICATOR_STATUS . INFO ) {
18711890 newReportOption . brickRoadIndicator = shouldShowGBR ? CONST . BRICK_ROAD_INDICATOR_STATUS . INFO : null ;
18721891 }
@@ -2168,6 +2187,7 @@ type SearchOptionsConfig = {
21682187 includeCurrentUser ?: boolean ;
21692188 countryCode ?: number ;
21702189 shouldShowGBR ?: boolean ;
2190+ shouldUnreadBeBold ?: boolean ;
21712191} ;
21722192
21732193/**
@@ -2187,6 +2207,7 @@ function getSearchOptions({
21872207 includeCurrentUser = false ,
21882208 countryCode = CONST . DEFAULT_COUNTRY_CODE ,
21892209 shouldShowGBR = false ,
2210+ shouldUnreadBeBold = false ,
21902211} : SearchOptionsConfig ) : Options {
21912212 Timing . start ( CONST . TIMING . LOAD_SEARCH_OPTIONS ) ;
21922213 Performance . markStart ( CONST . TIMING . LOAD_SEARCH_OPTIONS ) ;
@@ -2214,6 +2235,7 @@ function getSearchOptions({
22142235 searchString : searchQuery ,
22152236 includeUserToInvite,
22162237 shouldShowGBR,
2238+ shouldUnreadBeBold,
22172239 } ,
22182240 countryCode ,
22192241 ) ;
0 commit comments