Skip to content

Commit af44973

Browse files
puneetlathOSBotify
authored andcommitted
Merge pull request #76059 from Expensify/revert-73242-follow-up-71434
Revert "fix: thread header is not showing the exact message sent" (cherry picked from commit 06c12c8) (cherry-picked to staging by puneetlath)
1 parent a9427cd commit af44973

File tree

7 files changed

+5
-30
lines changed

7 files changed

+5
-30
lines changed

src/components/DisplayNames/index.native.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,9 @@ import TextWithEmojiFragment from '@pages/home/report/comment/TextWithEmojiFragm
88
import type DisplayNamesProps from './types';
99

1010
// As we don't have to show tooltips of the Native platform so we simply render the full display names list.
11-
function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfLines = 1, renderAdditionalText, forwardedFSClass, testID, shouldParseFullTitle = true}: DisplayNamesProps) {
11+
function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfLines = 1, renderAdditionalText, forwardedFSClass, testID}: DisplayNamesProps) {
1212
const {translate} = useLocalize();
1313
const titleContainsTextAndCustomEmoji = useMemo(() => containsCustomEmoji(fullTitle) && !containsOnlyCustomEmoji(fullTitle), [fullTitle]);
14-
const title = useMemo(() => {
15-
const processedTitle = shouldParseFullTitle ? Parser.htmlToText(fullTitle) : fullTitle;
16-
return StringUtils.lineBreaksToSpaces(processedTitle) || translate('common.hidden');
17-
}, [fullTitle, shouldParseFullTitle, translate]);
18-
1914
return (
2015
<Text
2116
accessibilityLabel={accessibilityLabel}
@@ -26,11 +21,11 @@ function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfL
2621
>
2722
{titleContainsTextAndCustomEmoji ? (
2823
<TextWithEmojiFragment
29-
message={title}
24+
message={StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden')}
3025
style={textStyles}
3126
/>
3227
) : (
33-
title
28+
StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden')
3429
)}
3530
{renderAdditionalText?.()}
3631
</Text>

src/components/DisplayNames/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useMemo} from 'react';
1+
import React from 'react';
22
import useLocalize from '@hooks/useLocalize';
33
import Parser from '@libs/Parser';
44
import StringUtils from '@libs/StringUtils';
@@ -16,13 +16,9 @@ function DisplayNames({
1616
displayNamesWithTooltips,
1717
renderAdditionalText,
1818
forwardedFSClass,
19-
shouldParseFullTitle = true,
2019
}: DisplayNamesProps) {
2120
const {translate} = useLocalize();
22-
const title = useMemo(() => {
23-
const processedTitle = shouldParseFullTitle ? Parser.htmlToText(fullTitle) : fullTitle;
24-
return StringUtils.lineBreaksToSpaces(processedTitle) || translate('common.hidden');
25-
}, [fullTitle, shouldParseFullTitle, translate]);
21+
const title = StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden');
2622

2723
if (!tooltipEnabled) {
2824
return (

src/components/DisplayNames/types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ type DisplayNamesProps = ForwardedFSClassProps & {
2020
/** The full title of the DisplayNames component (not split up) */
2121
fullTitle: string;
2222

23-
/**
24-
* Whether `fullTitle` should be processed through Parser.htmlToText().
25-
* Set to true when `fullTitle` contains HTML that needs to be converted to plain text
26-
* Set to false when `fullTitle` is already plain text or when you want to preserve
27-
* any HTML formatting in the display.
28-
*/
29-
shouldParseFullTitle?: boolean;
30-
3123
/** Array of objects that map display names to their corresponding tooltip */
3224
displayNamesWithTooltips?: DisplayNameWithTooltip[];
3325

src/components/HeaderWithBackButton/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ type HeaderWithBackButtonProps = Partial<ChildrenProps> & {
132132
/** Whether we should enable detail page navigation */
133133
shouldEnableDetailPageNavigation?: boolean;
134134

135-
/** Number of lines to display for the title */
136-
numberOfTitleLines?: number;
137-
138135
/** Whether we should overlay the 3 dots menu */
139136
shouldOverlayDots?: boolean;
140137

src/components/LHNOptionsList/OptionRowLHN.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ function OptionRowLHN({
267267
<DisplayNames
268268
accessibilityLabel={translate('accessibilityHints.chatUserDisplayNames')}
269269
fullTitle={optionItem.text ?? ''}
270-
shouldParseFullTitle={false}
271270
displayNamesWithTooltips={optionItem.displayNamesWithTooltips ?? []}
272271
tooltipEnabled
273272
numberOfLines={1}

src/components/MenuItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ function MenuItem({
596596
return (
597597
<DisplayNames
598598
fullTitle={title}
599-
shouldParseFullTitle={!shouldRenderAsHTML}
600599
displayNamesWithTooltips={titleWithTooltips}
601600
tooltipEnabled
602601
numberOfLines={1}

src/pages/home/HeaderView.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
153153
const policyDescription = getPolicyDescriptionText(policy);
154154
const isPersonalExpenseChat = isPolicyExpenseChat && isCurrentUserSubmitter(report);
155155
const hasTeam2025Pricing = useHasTeam2025Pricing();
156-
// This is used to ensure that we display the text exactly as the user entered it when displaying thread header text, instead of parsing their text to HTML.
157-
const shouldParseFullTitle = parentReportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT;
158156
const subscriptionPlan = useSubscriptionPlan();
159157
const ancestors = useAncestors(report);
160158
const displayNamesFSClass = FS.getChatFSClass(personalDetails, report);
@@ -302,7 +300,6 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
302300
<DisplayNames
303301
fullTitle={title}
304302
displayNamesWithTooltips={displayNamesWithTooltips}
305-
shouldParseFullTitle={shouldParseFullTitle}
306303
tooltipEnabled
307304
numberOfLines={1}
308305
textStyles={[styles.headerText, styles.pre]}

0 commit comments

Comments
 (0)