11import React , { useMemo } from 'react' ;
22import useDefaultAvatars from '@hooks/useDefaultAvatars' ;
33import useOnyx from '@hooks/useOnyx' ;
4- import { getDefaultGroupAvatar , getPolicyName , getReportName , getWorkspaceIcon , isGroupChat , isThread , isUserCreatedPolicyRoom } from '@libs/ReportUtils' ;
4+ import useReportAttributes from '@hooks/useReportAttributes' ;
5+ import { getReportName } from '@libs/ReportNameUtils' ;
6+ import { getDefaultGroupAvatar , getPolicyName , getWorkspaceIcon , isGroupChat , isThread , isUserCreatedPolicyRoom } from '@libs/ReportUtils' ;
57import { getFullSizeAvatar } from '@libs/UserAvatarUtils' ;
68import type { AttachmentModalBaseContentProps } from '@pages/media/AttachmentModalScreen/AttachmentModalBaseContent/types' ;
79import AttachmentModalContainer from '@pages/media/AttachmentModalScreen/AttachmentModalContainer' ;
@@ -17,29 +19,20 @@ function ReportAvatarModalContent({navigation, route}: AttachmentModalScreenProp
1719 const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` ) ;
1820 const [ policy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ) ;
1921 const [ isLoadingApp = true ] = useOnyx ( ONYXKEYS . IS_LOADING_APP ) ;
22+ const reportAttributes = useReportAttributes ( ) ;
2023
2124 const attachment : AttachmentModalBaseContentProps = useMemo ( ( ) => {
2225 if ( isGroupChat ( report ) && ! isThread ( report ) ) {
2326 return {
2427 source : report ?. avatarUrl ? getFullSizeAvatar ( { avatarSource : report . avatarUrl , defaultAvatars} ) : getDefaultGroupAvatar ( report ?. reportID ) ,
25- // eslint-disable-next-line @typescript-eslint/no-deprecated
26- headerTitle : getReportName ( { report} ) ,
28+ headerTitle : getReportName ( report , reportAttributes ) ,
2729 isWorkspaceAvatar : false ,
2830 } ;
2931 }
3032 if ( isUserCreatedPolicyRoom ( report ) && report ?. avatarUrl ) {
3133 return {
3234 source : getFullSizeAvatar ( { avatarSource : report . avatarUrl , defaultAvatars} ) ,
33- // eslint-disable-next-line @typescript-eslint/no-deprecated
34- headerTitle : getReportName ( { report} ) ,
35- isWorkspaceAvatar : false ,
36- } ;
37- }
38- if ( isUserCreatedPolicyRoom ( report ) && report ?. avatarUrl ) {
39- return {
40- source : getFullSizeAvatar ( { avatarSource : report . avatarUrl , defaultAvatars} ) ,
41- // eslint-disable-next-line @typescript-eslint/no-deprecated
42- headerTitle : getReportName ( { report} ) ,
35+ headerTitle : getReportName ( report , reportAttributes ) ,
4336 isWorkspaceAvatar : false ,
4437 } ;
4538 }
@@ -51,7 +44,7 @@ function ReportAvatarModalContent({navigation, route}: AttachmentModalScreenProp
5144 originalFileName : policy ?. originalFileName ?? policy ?. id ?? report ?. policyID ,
5245 isWorkspaceAvatar : true ,
5346 } ;
54- } , [ policy , report , defaultAvatars ] ) ;
47+ } , [ policy , report , defaultAvatars , reportAttributes ] ) ;
5548
5649 const onDownloadAttachment = useDownloadAttachment ( ) ;
5750
0 commit comments