@@ -511,6 +511,7 @@ function getOptionData({
511511 parentReportAction,
512512 lastMessageTextFromReport : lastMessageTextFromReportProp ,
513513 invoiceReceiverPolicy,
514+ localeCompare,
514515} : {
515516 report : OnyxEntry < Report > ;
516517 oneTransactionThreadReport : OnyxEntry < Report > ;
@@ -521,6 +522,7 @@ function getOptionData({
521522 lastMessageTextFromReport ?: string ;
522523 invoiceReceiverPolicy ?: OnyxEntry < Policy > ;
523524 reportAttributes : OnyxEntry < ReportAttributes > ;
525+ localeCompare : LocaleContextProps [ 'localeCompare' ] ;
524526} ) : OptionData | undefined {
525527 // When a user signs out, Onyx is cleared. Due to the lazy rendering with a virtual list, it's possible for
526528 // this method to be called after the Onyx data has been cleared out. In that case, it's fine to do
@@ -614,7 +616,7 @@ function getOptionData({
614616 const status = personalDetail ?. status ?? '' ;
615617
616618 // We only create tooltips for the first 10 users or so since some reports have hundreds of users, causing performance to degrade.
617- const displayNamesWithTooltips = getDisplayNamesWithTooltips ( ( participantPersonalDetailList || [ ] ) . slice ( 0 , 10 ) , hasMultipleParticipants , undefined , isSelfDM ( report ) ) ;
619+ const displayNamesWithTooltips = getDisplayNamesWithTooltips ( ( participantPersonalDetailList || [ ] ) . slice ( 0 , 10 ) , hasMultipleParticipants , localeCompare , undefined , isSelfDM ( report ) ) ;
618620
619621 const lastAction = visibleReportActionItems [ report . reportID ] ;
620622 // lastActorAccountID can be an empty string
@@ -790,14 +792,18 @@ function getOptionData({
790792 : getLastVisibleMessage ( report . reportID , result . isAllowedToComment , { } , lastAction ) ?. lastMessageText ;
791793
792794 if ( ! result . alternateText ) {
793- result . alternateText = formatReportLastMessageText ( getWelcomeMessage ( report , policy , ! ! result . private_isArchived ) . messageText ?? translateLocal ( 'report.noActivityYet' ) ) ;
795+ result . alternateText = formatReportLastMessageText (
796+ getWelcomeMessage ( report , policy , localeCompare , ! ! result . private_isArchived ) . messageText ?? translateLocal ( 'report.noActivityYet' ) ,
797+ ) ;
794798 }
795799 }
796800 result . alternateText = prefix + result . alternateText ;
797801 } else {
798802 if ( ! lastMessageText ) {
799- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
800- lastMessageText = formatReportLastMessageText ( getWelcomeMessage ( report , policy , ! ! result . private_isArchived ) . messageText || translateLocal ( 'report.noActivityYet' ) ) ;
803+ lastMessageText = formatReportLastMessageText (
804+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
805+ getWelcomeMessage ( report , policy , localeCompare , ! ! result . private_isArchived ) . messageText || translateLocal ( 'report.noActivityYet' ) ,
806+ ) ;
801807 }
802808 if ( shouldShowLastActorDisplayName ( report , lastActorDetails , lastAction ) && ! isArchivedReport ( reportNameValuePairs ) ) {
803809 result . alternateText = `${ lastActorDisplayName } : ${ formatReportLastMessageText ( Parser . htmlToText ( lastMessageText ) ) } ` ;
@@ -844,7 +850,13 @@ function getOptionData({
844850 return result ;
845851}
846852
847- function getWelcomeMessage ( report : OnyxEntry < Report > , policy : OnyxEntry < Policy > , isReportArchived = false , reportDetailsLink = '' ) : WelcomeMessage {
853+ function getWelcomeMessage (
854+ report : OnyxEntry < Report > ,
855+ policy : OnyxEntry < Policy > ,
856+ localeCompare : LocaleContextProps [ 'localeCompare' ] ,
857+ isReportArchived = false ,
858+ reportDetailsLink = '' ,
859+ ) : WelcomeMessage {
848860 const welcomeMessage : WelcomeMessage = { } ;
849861 if ( isChatThread ( report ) || isTaskReport ( report ) ) {
850862 return welcomeMessage ;
@@ -881,7 +893,7 @@ function getWelcomeMessage(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>,
881893 welcomeMessage . phrase1 = translateLocal ( 'reportActionsView.beginningOfChatHistory' ) ;
882894 const participantAccountIDs = getParticipantsAccountIDsForDisplay ( report , undefined , undefined , true ) ;
883895 const isMultipleParticipant = participantAccountIDs . length > 1 ;
884- const displayNamesWithTooltips = getDisplayNamesWithTooltips ( getPersonalDetailsForAccountIDs ( participantAccountIDs , allPersonalDetails ) , isMultipleParticipant ) ;
896+ const displayNamesWithTooltips = getDisplayNamesWithTooltips ( getPersonalDetailsForAccountIDs ( participantAccountIDs , allPersonalDetails ) , isMultipleParticipant , localeCompare ) ;
885897 const displayNamesWithTooltipsText = displayNamesWithTooltips
886898 . map ( ( { displayName} , index ) => {
887899 if ( index === displayNamesWithTooltips . length - 1 ) {
0 commit comments