@@ -9,11 +9,12 @@ import MenuItem from '@components/MenuItem';
99import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription' ;
1010import { ModalActions } from '@components/Modal/Global/ModalContext' ;
1111import OfflineWithFeedback from '@components/OfflineWithFeedback' ;
12- import { usePolicyCategories , usePolicyTags } from '@components/OnyxListItemProvider' ;
12+ import { usePersonalDetails , usePolicyCategories , usePolicyTags } from '@components/OnyxListItemProvider' ;
1313import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView' ;
1414import { useSearchStateContext } from '@components/Search/SearchContext' ;
1515import Switch from '@components/Switch' ;
1616import Text from '@components/Text' ;
17+ import UserPills from '@components/UserPills' ;
1718import ViolationMessages from '@components/ViolationMessages' ;
1819import { useWideRHPState } from '@components/WideRHPContextProvider' ;
1920import useActiveRoute from '@hooks/useActiveRoute' ;
@@ -45,7 +46,7 @@ import {getDecodedCategoryName, isCategoryMissing} from '@libs/CategoryUtils';
4546import DistanceRequestUtils from '@libs/DistanceRequestUtils' ;
4647import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
4748import { getRateFromMerchant } from '@libs/MergeTransactionUtils' ;
48- import { hasEnabledOptions } from '@libs/OptionsListUtils' ;
49+ import { hasEnabledOptions , sortAlphabetically } from '@libs/OptionsListUtils' ;
4950import Parser from '@libs/Parser' ;
5051import {
5152 canSubmitPerDiemExpenseFromWorkspace ,
@@ -176,7 +177,7 @@ function MoneyRequestView({
176177 const StyleUtils = useStyleUtils ( ) ;
177178 const { isOffline} = useNetwork ( ) ;
178179 const { environmentURL} = useEnvironment ( ) ;
179- const { translate, toLocaleDigit} = useLocalize ( ) ;
180+ const { translate, toLocaleDigit, localeCompare } = useLocalize ( ) ;
180181 const { convertToDisplayString, getCurrencySymbol} = useCurrencyListActions ( ) ;
181182 const { getReportRHPActiveRoute} = useActiveRoute ( ) ;
182183 const { showConfirmModal} = useConfirmModal ( ) ;
@@ -236,6 +237,7 @@ function MoneyRequestView({
236237 const transactionViolations = useTransactionViolations ( transaction ?. transactionID ) ;
237238 const [ outstandingReportsByPolicyID ] = useOnyx ( ONYXKEYS . DERIVED . OUTSTANDING_REPORTS_BY_POLICY_ID ) ;
238239 const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
240+ const personalDetailsList = usePersonalDetails ( ) ;
239241 const currentUserAccountIDParam = currentUserPersonalDetails . accountID ;
240242 const currentUserEmailParam = currentUserPersonalDetails . login ?? '' ;
241243 const { isBetaEnabled} = usePermissions ( ) ;
@@ -1166,12 +1168,40 @@ function MoneyRequestView({
11661168 < OfflineWithFeedback pendingAction = { getPendingFieldAction ( 'attendees' ) } >
11671169 < MenuItemWithTopDescription
11681170 key = "attendees"
1169- title = { getAttendeesTitle }
1171+ accessibilityLabel = { ` ${ translate ( 'iou.attendees' ) } , ${ getAttendeesTitle } ` }
11701172 description = { `${ translate ( 'iou.attendees' ) } ${
11711173 Array . isArray ( actualAttendees ) && actualAttendees . length > 1 && formattedPerAttendeeAmount
11721174 ? `${ CONST . DOT_SEPARATOR } ${ formattedPerAttendeeAmount } ${ translate ( 'common.perPerson' ) } `
11731175 : ''
11741176 } `}
1177+ descriptionTextStyle = { styles . textLabelSupportingNormal }
1178+ titleComponent = {
1179+ Array . isArray ( actualAttendees ) ? (
1180+ < UserPills
1181+ users = { sortAlphabetically (
1182+ actualAttendees . map ( ( a ) => {
1183+ const pd = a ?. accountID ? personalDetailsList ?. [ a . accountID ] : undefined ;
1184+ const freshAvatar = typeof pd ?. avatar === 'string' ? pd . avatar : undefined ;
1185+ return {
1186+ ...a ,
1187+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1188+ displayName : pd ?. displayName || a ?. displayName ,
1189+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1190+ avatarUrl : freshAvatar || a ?. avatarUrl ,
1191+ } ;
1192+ } ) ,
1193+ 'displayName' ,
1194+ localeCompare ,
1195+ ) . map ( ( a ) => ( {
1196+ avatar : a ?. avatarUrl ,
1197+ displayName : a ?. displayName ?? a ?. login ?? a ?. email ?? '' ,
1198+ accountID : a ?. accountID ,
1199+ email : a ?. email ?? a ?. login ,
1200+ } ) ) }
1201+ maxVisible = { canEdit ? undefined : actualAttendees . length }
1202+ />
1203+ ) : undefined
1204+ }
11751205 style = { [ styles . moneyRequestMenuItem ] }
11761206 titleStyle = { styles . flex1 }
11771207 onPress = { ( ) => {
@@ -1181,7 +1211,6 @@ function MoneyRequestView({
11811211 errorText = { getErrorForField ( 'attendees' ) }
11821212 interactive = { canEdit }
11831213 shouldShowRightIcon = { canEdit }
1184- shouldRenderAsHTML
11851214 copyValue = { attendeesCopyValue }
11861215 copyable = { ! ! attendeesCopyValue }
11871216 />
0 commit comments