From 200399285c9e3d4fb392598bee92125066b4aaf0 Mon Sep 17 00:00:00 2001 From: ginsuma <13113013+ginsuma@users.noreply.github.com> Date: Mon, 16 Oct 2023 18:47:32 +0700 Subject: [PATCH] Fix shouldUseFullTitle in ReportDetailsPage --- src/libs/ReportUtils.js | 9 +++++++++ src/pages/ReportDetailsPage.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 0b7bbfd61461..d34517a80929 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -3871,6 +3871,14 @@ function isReportDraft(report) { return isExpenseReport(report) && lodashGet(report, 'stateNum') === CONST.REPORT.STATE_NUM.OPEN && lodashGet(report, 'statusNum') === CONST.REPORT.STATUS.OPEN; } +/** + * @param {Object} report + * @returns {Boolean} + */ +function shouldUseFullTitleToDisplay(report) { + return isMoneyRequestReport(report) || isPolicyExpenseChat(report) || isChatRoom(report) || isChatThread(report) || isTaskReport(report); +} + export { getReportParticipantsTitle, isReportMessageAttachment, @@ -4017,4 +4025,5 @@ export { getIOUReportActionDisplayMessage, isWaitingForTaskCompleteFromAssignee, isReportDraft, + shouldUseFullTitleToDisplay, }; diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js index 42a535844c72..31f413af95a9 100644 --- a/src/pages/ReportDetailsPage.js +++ b/src/pages/ReportDetailsPage.js @@ -61,7 +61,7 @@ const defaultProps = { function ReportDetailsPage(props) { const policy = useMemo(() => props.policies[`${ONYXKEYS.COLLECTION.POLICY}${props.report.policyID}`], [props.policies, props.report.policyID]); const isPolicyAdmin = useMemo(() => PolicyUtils.isPolicyAdmin(policy), [policy]); - const shouldUseFullTitle = ReportUtils.isTaskReport(props.report); + const shouldUseFullTitle = useMemo(() => ReportUtils.shouldUseFullTitleToDisplay(props.report), [props.report]); const isChatRoom = useMemo(() => ReportUtils.isChatRoom(props.report), [props.report]); const isThread = useMemo(() => ReportUtils.isChatThread(props.report), [props.report]); const isUserCreatedPolicyRoom = useMemo(() => ReportUtils.isUserCreatedPolicyRoom(props.report), [props.report]);