Skip to content

Commit

Permalink
Merge pull request #44526 from bernhardoj/fix/44430-thread-title-does…
Browse files Browse the repository at this point in the history
…nt-update

[CP Staging] Fix thread title not updated in header and in LHN after editing parent message
  • Loading branch information
mountiny authored Jun 27, 2024
2 parents c4a4435 + 0496546 commit b26b9b1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3318,9 +3318,9 @@ function getInvoicesChatName(report: OnyxEntry<Report>): string {
/**
* Get the title for a report.
*/
function getReportName(report: OnyxEntry<Report>, policy?: OnyxEntry<Policy>): string {
function getReportName(report: OnyxEntry<Report>, policy?: OnyxEntry<Policy>, parentReportActionParam?: OnyxInputOrEntry<ReportAction>): string {
let formattedName: string | undefined;
const parentReportAction = ReportActionsUtils.getParentReportAction(report);
const parentReportAction = parentReportActionParam ?? ReportActionsUtils.getParentReportAction(report);
if (isChatThread(report)) {
if (!isEmptyObject(parentReportAction) && ReportActionsUtils.isTransactionThread(parentReportAction)) {
formattedName = getTransactionReportName(parentReportAction);
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@ function editReportComment(reportID: string, originalReportAction: OnyxEntry<Rep
text: reportComment,
},
],
lastModified: DateUtils.getDBTime(),
},
};

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 @@ -103,7 +103,7 @@ function HeaderView({
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 = ReportUtils.getReportName(reportHeaderData);
const title = ReportUtils.getReportName(reportHeaderData, undefined, parentReportAction);
const subtitle = ReportUtils.getChatRoomSubtitle(reportHeaderData);
const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(reportHeaderData);
const isConcierge = ReportUtils.isConciergeChatReport(report);
Expand Down

0 comments on commit b26b9b1

Please sign in to comment.