diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index efae0b5261d3..f1f1b1b2d524 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2995,6 +2995,10 @@ function getReportName(report: OnyxEntry, policy: OnyxEntry = nu return Localize.translateLocal('parentReportAction.deletedTask'); } + if (isGroupChat(report)) { + return getGroupChatName(undefined, true, report?.reportID) ?? ''; + } + if (isChatRoom(report) || isTaskReport(report)) { formattedName = report?.reportName; } diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 7f1dadab8c0e..e6720af53dfc 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -249,7 +249,10 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD /> ); - const reportName = useMemo(() => (isGroupChat ? ReportUtils.getGroupChatName(undefined, true, report.reportID ?? '') : ReportUtils.getReportName(report)), [report, isGroupChat]); + const reportName = + ReportUtils.isDeprecatedGroupDM(report) || ReportUtils.isGroupChat(report) + ? ReportUtils.getGroupChatName(undefined, false, report.reportID ?? '') + : ReportUtils.getReportName(report); return ( diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index 1a88719c2649..e274ce934aae 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -87,7 +87,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction, const isTaskReport = ReportUtils.isTaskReport(report); const reportHeaderData = !isTaskReport && !isChatThread && report.parentReportID ? parentReport : report; // Use sorted display names for the title for group chats on native small screen widths - const title = isGroupChat ? ReportUtils.getGroupChatName(undefined, true, report.reportID ?? '') : ReportUtils.getReportName(reportHeaderData); + const title = ReportUtils.getReportName(reportHeaderData); const subtitle = ReportUtils.getChatRoomSubtitle(reportHeaderData); const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(reportHeaderData); const isConcierge = ReportUtils.hasSingleParticipant(report) && participants.includes(CONST.ACCOUNT_ID.CONCIERGE); diff --git a/src/pages/settings/Report/ReportSettingsPage.tsx b/src/pages/settings/Report/ReportSettingsPage.tsx index 7c765d3d5ca8..69b4c52eebf4 100644 --- a/src/pages/settings/Report/ReportSettingsPage.tsx +++ b/src/pages/settings/Report/ReportSettingsPage.tsx @@ -48,10 +48,7 @@ function ReportSettingsPage({report, policies}: ReportSettingsPageProps) { const shouldShowNotificationPref = !isMoneyRequestReport && report?.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN; const roomNameLabel = translate(isMoneyRequestReport ? 'workspace.editor.nameInputLabel' : 'newRoomPage.roomName'); - const reportName = - ReportUtils.isDeprecatedGroupDM(report) || ReportUtils.isGroupChat(report) - ? ReportUtils.getGroupChatName(undefined, false, report.reportID ?? '') - : ReportUtils.getReportName(report); + const reportName = ReportUtils.getReportName(report); const shouldShowWriteCapability = !isMoneyRequestReport;