Skip to content

Commit 3bb114b

Browse files
committed
Revert #74928
1 parent 9d3daec commit 3bb114b

File tree

7 files changed

+9
-159
lines changed

7 files changed

+9
-159
lines changed

src/components/DisplayNames/index.native.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ 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, shouldParseHtml = false}: DisplayNamesProps) {
11+
function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfLines = 1, renderAdditionalText, forwardedFSClass, testID}: DisplayNamesProps) {
1212
const {translate} = useLocalize();
13-
const title = shouldParseHtml
14-
? StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden')
15-
: StringUtils.lineBreaksToSpaces(fullTitle) || translate('common.hidden');
1613
const titleContainsTextAndCustomEmoji = useMemo(() => containsCustomEmoji(fullTitle) && !containsOnlyCustomEmoji(fullTitle), [fullTitle]);
1714
return (
1815
<Text
@@ -24,11 +21,11 @@ function DisplayNames({accessibilityLabel, fullTitle, textStyles = [], numberOfL
2421
>
2522
{titleContainsTextAndCustomEmoji ? (
2623
<TextWithEmojiFragment
27-
message={title}
24+
message={StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden')}
2825
style={textStyles}
2926
/>
3027
) : (
31-
title
28+
StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden')
3229
)}
3330
{renderAdditionalText?.()}
3431
</Text>

src/components/DisplayNames/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ function DisplayNames({
1616
displayNamesWithTooltips,
1717
renderAdditionalText,
1818
forwardedFSClass,
19-
shouldParseHtml = false,
2019
}: DisplayNamesProps) {
2120
const {translate} = useLocalize();
22-
const title = shouldParseHtml
23-
? StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden')
24-
: StringUtils.lineBreaksToSpaces(fullTitle) || translate('common.hidden');
21+
const title = StringUtils.lineBreaksToSpaces(Parser.htmlToText(fullTitle)) || translate('common.hidden');
2522

2623
if (!tooltipEnabled) {
2724
return (

src/components/DisplayNames/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ type DisplayNamesProps = ForwardedFSClassProps & {
4949

5050
/** TestID indicating order */
5151
testID?: number;
52-
53-
/** Whether to parse HTML in the fullTitle */
54-
shouldParseHtml?: boolean;
5552
};
5653

5754
export default DisplayNamesProps;

src/libs/ReportUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5682,7 +5682,7 @@ function getReportName(
56825682
}
56835683

56845684
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION)) {
5685-
return Parser.htmlToText(getUnreportedTransactionMessage());
5685+
return getUnreportedTransactionMessage();
56865686
}
56875687

56885688
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_MAX_EXPENSE_AMOUNT_NO_RECEIPT)) {

src/pages/ReportDetailsPage.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ConfirmModal from '@components/ConfirmModal';
1010
import DisplayNames from '@components/DisplayNames';
1111
import HeaderWithBackButton from '@components/HeaderWithBackButton';
1212
import MentionReportContext from '@components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext';
13+
import * as Expensicons from '@components/Icon/Expensicons';
1314
import MenuItem from '@components/MenuItem';
1415
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
1516
import OfflineWithFeedback from '@components/OfflineWithFeedback';
@@ -26,7 +27,6 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'
2627
import useDeleteTransactions from '@hooks/useDeleteTransactions';
2728
import useDuplicateTransactionsAndViolations from '@hooks/useDuplicateTransactionsAndViolations';
2829
import useGetIOUReportFromReportAction from '@hooks/useGetIOUReportFromReportAction';
29-
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
3030
import useLocalize from '@hooks/useLocalize';
3131
import useNetwork from '@hooks/useNetwork';
3232
import useOnyx from '@hooks/useOnyx';
@@ -41,6 +41,7 @@ import Navigation from '@libs/Navigation/Navigation';
4141
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
4242
import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types';
4343
import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils';
44+
import Parser from '@libs/Parser';
4445
import Permissions from '@libs/Permissions';
4546
import {isPolicyAdmin as isPolicyAdminUtil, isPolicyEmployee as isPolicyEmployeeUtil, shouldShowPolicy} from '@libs/PolicyUtils';
4647
import {getOneTransactionThreadReportID, getOriginalMessage, getTrackExpenseActionableWhisper, isDeletedAction, isMoneyRequestAction, isTrackExpenseAction} from '@libs/ReportActionsUtils';
@@ -148,7 +149,6 @@ const CASES = {
148149
type CaseID = ValueOf<typeof CASES>;
149150

150151
function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetailsPageProps) {
151-
const Expensicons = useMemoizedLazyExpensifyIcons(['Bug', 'Building', 'Camera', 'Checkmark', 'Exit', 'Folder', 'Gear', 'Pencil', 'Send', 'Trashcan', 'UserPlus', 'Users'] as const);
152152
const {translate, localeCompare} = useLocalize();
153153
const {isOffline} = useNetwork();
154154
const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy();
@@ -332,7 +332,8 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
332332

333333
const shouldShowLeaveButton = canLeaveChat(report, policy, !!reportNameValuePairs?.private_isArchived);
334334
const shouldShowGoToWorkspace = shouldShowPolicy(policy, false, currentUserPersonalDetails?.email) && !policy?.isJoinRequestPending;
335-
const reportName = getReportName(report, undefined, undefined, undefined, undefined, reportAttributes);
335+
336+
const reportName = Parser.htmlToText(getReportName(report, undefined, undefined, undefined, undefined, reportAttributes));
336337

337338
const additionalRoomDetails =
338339
(isPolicyExpenseChat && !!report?.isOwnPolicyExpenseChat) || isExpenseReportUtil(report) || isPolicyExpenseChat || isInvoiceRoom
@@ -577,7 +578,6 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
577578
isRestrictedToPreferredPolicy,
578579
preferredPolicyID,
579580
introSelected,
580-
Expensicons,
581581
]);
582582

583583
const displayNamesWithTooltips = useMemo(() => {
@@ -660,7 +660,6 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
660660
policy,
661661
participants,
662662
moneyRequestReport?.reportID,
663-
Expensicons,
664663
]);
665664

666665
const canJoin = canJoinChat(report, parentReportAction, policy, !!reportNameValuePairs?.private_isArchived);

tests/unit/DisplayNamesShouldParseHTMLTest.tsx

Lines changed: 0 additions & 113 deletions
This file was deleted.

tests/unit/ReportUtilsTest.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,33 +1125,6 @@ describe('ReportUtils', () => {
11251125
);
11261126
});
11271127
});
1128-
1129-
describe('Unreported transaction thread', () => {
1130-
test('HTML is stripped from unreported transaction message', () => {
1131-
const transactionThread = {
1132-
...LHNTestUtils.getFakeReport(),
1133-
type: CONST.REPORT.TYPE.CHAT,
1134-
reportID: '123',
1135-
parentReportID: '456',
1136-
};
1137-
1138-
const unreportedTransactionAction = {
1139-
actionName: CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION,
1140-
originalMessage: {
1141-
fromReportID: '789',
1142-
},
1143-
} as ReportAction;
1144-
1145-
const reportName = getReportName(transactionThread, undefined, unreportedTransactionAction);
1146-
1147-
// Should NOT contain HTML tags
1148-
expect(reportName).not.toContain('<a href');
1149-
expect(reportName).not.toContain('</a>');
1150-
// Should contain the text content
1151-
expect(reportName).toContain('moved this expense');
1152-
expect(reportName).toContain('personal space');
1153-
});
1154-
});
11551128
});
11561129

11571130
// Need to merge the same tests

0 commit comments

Comments
 (0)