@@ -41,13 +41,13 @@ import type {ViolationField} from '@hooks/useViolations';
4141import useViolations from '@hooks/useViolations' ;
4242import { updateMoneyRequestBillable , updateMoneyRequestReimbursable , updateMoneyRequestTaxRate } from '@libs/actions/IOU/UpdateMoneyRequest' ;
4343import initSplitExpense from '@libs/actions/SplitExpenses' ;
44- import { getIsMissingAttendeesViolation } from '@libs/AttendeeUtils' ;
44+ import { enrichAndSortAttendees , getIsMissingAttendeesViolation } from '@libs/AttendeeUtils' ;
4545import { getBrokenConnectionUrlToFixPersonalCard , getCompanyCardDescription } from '@libs/CardUtils' ;
4646import { getDecodedCategoryName , isCategoryMissing } from '@libs/CategoryUtils' ;
4747import DistanceRequestUtils from '@libs/DistanceRequestUtils' ;
4848import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
4949import { getRateFromMerchant } from '@libs/MergeTransactionUtils' ;
50- import { hasEnabledOptions , sortAlphabetically } from '@libs/OptionsListUtils' ;
50+ import { hasEnabledOptions } from '@libs/OptionsListUtils' ;
5151import Parser from '@libs/Parser' ;
5252import {
5353 canSubmitPerDiemExpenseFromWorkspace ,
@@ -82,6 +82,7 @@ import {
8282} from '@libs/ReportUtils' ;
8383import { hasEnabledTags , shouldShowDependentTagList } from '@libs/TagsOptionsListUtils' ;
8484import {
85+ getAttendeesListDisplayString ,
8586 getBillable ,
8687 getCurrency ,
8788 getDescription ,
@@ -283,7 +284,8 @@ function MoneyRequestView({
283284 const isTransactionScanning = isScanning ( updatedTransaction ?? transaction ) ;
284285 const hasRoute = hasRouteTransactionUtils ( transactionBackup ?? transaction , isDistanceRequest ) ;
285286
286- const actualAttendees = isFromMergeTransaction && updatedTransaction ? updatedTransaction . comment ?. attendees : transactionAttendees ;
287+ const rawActualAttendees = isFromMergeTransaction && updatedTransaction ? updatedTransaction . comment ?. attendees : transactionAttendees ;
288+ const actualAttendees = enrichAndSortAttendees ( rawActualAttendees , personalDetailsList , localeCompare ) ;
287289
288290 // Use the updated transaction amount in merge flow to have correct positive/negative sign
289291 const actualAmount = isFromMergeTransaction && updatedTransaction ? updatedTransaction . amount : transactionAmount ;
@@ -802,7 +804,8 @@ function MoneyRequestView({
802804 const previousTagLength = getLengthOfTag ( previousTag ?? '' ) ;
803805 const currentTagLength = getLengthOfTag ( currentTransactionTag ?? '' ) ;
804806
805- const getAttendeesTitle = Array . isArray ( actualAttendees ) ? actualAttendees . map ( ( item ) => item ?. displayName ?? item ?. login ) . join ( ', ' ) : '' ;
807+ // actualAttendees is already sorted by enrichAndSortAttendees above; pass without localeCompare to preserve that order while stripping the SMS domain.
808+ const getAttendeesTitle = Array . isArray ( actualAttendees ) ? getAttendeesListDisplayString ( actualAttendees ) : '' ;
806809 const attendeesCopyValue = ! canEdit ? getAttendeesTitle : undefined ;
807810
808811 const tagList = policyTagLists . map ( ( { name, orderWeight, tags} , index ) => {
@@ -1171,21 +1174,7 @@ function MoneyRequestView({
11711174 titleComponent = {
11721175 Array . isArray ( actualAttendees ) ? (
11731176 < UserPills
1174- users = { sortAlphabetically (
1175- actualAttendees . map ( ( a ) => {
1176- const pd = a ?. accountID ? personalDetailsList ?. [ a . accountID ] : undefined ;
1177- const freshAvatar = typeof pd ?. avatar === 'string' ? pd . avatar : undefined ;
1178- return {
1179- ...a ,
1180- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1181- displayName : pd ?. displayName || a ?. displayName ,
1182- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1183- avatarUrl : freshAvatar || a ?. avatarUrl ,
1184- } ;
1185- } ) ,
1186- 'displayName' ,
1187- localeCompare ,
1188- ) . map ( ( a ) => ( {
1177+ users = { actualAttendees . map ( ( a ) => ( {
11891178 avatar : a ?. avatarUrl ,
11901179 displayName : a ?. displayName ?? a ?. login ?? a ?. email ?? '' ,
11911180 accountID : a ?. accountID ,
0 commit comments