-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: Invoice report title in message preview shows an incorrect report title #78992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6573442
3d107d8
95f0a45
f88dbd0
8b29ced
7eed111
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,8 @@ import { | |
| getPolicyName, | ||
| getReportDescription, | ||
| getReportName, | ||
| getReportStatusColorStyle, | ||
| getReportStatusTranslation, | ||
| hasReportNameError, | ||
| isAdminRoom, | ||
| isArchivedReport, | ||
|
|
@@ -59,6 +61,7 @@ import { | |
| isDeprecatedGroupDM, | ||
| isExpenseRequest, | ||
| isGroupChat as isGroupChatReportUtils, | ||
| isInvoiceReport, | ||
| isInvoiceRoom, | ||
| isOneTransactionThread, | ||
| isOpenTaskReport, | ||
|
|
@@ -139,7 +142,9 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked, | |
| const isChatRoom = isChatRoomReportUtils(report); | ||
| const isPolicyExpenseChat = isPolicyExpenseChatReportUtils(report); | ||
| const isTaskReport = isTaskReportReportUtils(report); | ||
| const reportHeaderData = !isTaskReport && !isChatThread && report?.parentReportID ? parentReport : report; | ||
| // This is used to check if the report is a chat thread and has a parent invoice report. | ||
| const isParentInvoiceAndIsChatThread = isChatThread && !!parentReport && isInvoiceReport(parentReport); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possible to simplify this to use util?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I though this too to move in util but this has another logic too to decide whether to pick the parent report or not and I didn't want to break anything that's why I left HeaderView as it is. Even if we move this to util then we do need isParentInvoiceAndIsChatThread here as there are two factors to decide whether to pick the parent report or not in HeaderView, other locations has only one. |
||
| const reportHeaderData = (!isTaskReport && !isChatThread && report?.parentReportID) || isParentInvoiceAndIsChatThread ? parentReport : report; | ||
| const isParentOneTransactionThread = isOneTransactionThread(parentReport, grandParentReport, grandParentReportActions?.[`${parentReport?.parentReportActionID}`]); | ||
| const parentNavigationReport = isParentOneTransactionThread ? parentReport : reportHeaderData; | ||
| const isReportHeaderDataArchived = useReportIsArchived(reportHeaderData?.reportID); | ||
|
|
@@ -148,6 +153,11 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked, | |
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
| const title = getReportName(reportHeaderData, policy, parentReportAction, personalDetails, invoiceReceiverPolicy, undefined, undefined, isReportHeaderDataArchived); | ||
| const subtitle = getChatRoomSubtitle(reportHeaderData, false, isReportHeaderDataArchived); | ||
| // This is used to get the status badge for invoice report subtitle. | ||
| const statusTextForInvoiceReport = isParentInvoiceAndIsChatThread | ||
| ? getReportStatusTranslation({stateNum: reportHeaderData?.stateNum, statusNum: reportHeaderData?.statusNum, translate}) | ||
| : undefined; | ||
| const statusColorForInvoiceReport = isParentInvoiceAndIsChatThread ? getReportStatusColorStyle(theme, reportHeaderData?.stateNum, reportHeaderData?.statusNum) : {}; | ||
| const isParentReportHeaderDataArchived = useReportIsArchived(reportHeaderData?.parentReportID); | ||
| const parentNavigationSubtitleData = getParentNavigationSubtitle(parentNavigationReport, isParentReportHeaderDataArchived); | ||
| const reportDescription = Parser.htmlToText(getReportDescription(report)); | ||
|
|
@@ -320,6 +330,9 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked, | |
| </CaretWrapper> | ||
| {!isEmptyObject(parentNavigationSubtitleData) && ( | ||
| <ParentNavigationSubtitle | ||
| statusText={statusTextForInvoiceReport} | ||
| statusTextColor={statusColorForInvoiceReport?.textColor} | ||
| statusTextBackgroundColor={statusColorForInvoiceReport?.backgroundColor} | ||
| parentNavigationSubtitleData={parentNavigationSubtitleData} | ||
| reportID={parentNavigationReport?.reportID} | ||
| parentReportID={parentNavigationReport?.parentReportID} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be I missed earlier, we defined this but I don't see it being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.