Skip to content

Commit

Permalink
Merge pull request #40134 from gijoe0295/gijoe/39316
Browse files Browse the repository at this point in the history
Fix: Inconsistent group chat name in share code page
  • Loading branch information
marcaaron authored Apr 17, 2024
2 parents f7cc0af + c00a177 commit 8f6ebe4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3000,6 +3000,10 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu
return Localize.translateLocal('parentReportAction.deletedTask');
}

if (isGroupChat(report)) {
return getGroupChatName(undefined, true, report?.reportID) ?? '';
}

if (isChatRoom(report) || isTaskReport(report)) {
formattedName = report?.reportName;
}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<ScreenWrapper testID={ReportDetailsPage.displayName}>
<FullPageNotFoundView shouldShow={isEmptyObject(report)}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions src/pages/settings/Report/ReportSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8f6ebe4

Please sign in to comment.