-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Skip HTML parsing for task report names when content is plain text #83439
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
af6eb57
7ff67f2
9f07bcf
06d29e6
28bad5f
9e6da24
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 |
|---|---|---|
|
|
@@ -140,7 +140,7 @@ | |
|
|
||
| let allPersonalDetails: OnyxEntry<PersonalDetailsList>; | ||
|
|
||
| Onyx.connect({ | ||
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
| callback: (value) => { | ||
| allPersonalDetails = value; | ||
|
|
@@ -776,7 +776,9 @@ | |
| } | ||
|
|
||
| if (isTaskReport(report)) { | ||
| return Parser.htmlToText(report?.reportName ?? '').trim(); | ||
| const taskName = report?.reportName ?? ''; | ||
|
|
||
| return Parser.isHTML(taskName) ? Parser.htmlToText(taskName).trim() : taskName.trim(); | ||
|
Contributor
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. Is it worth moving the
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 think we should always target to maintain the separation of concerns
Contributor
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. Make senses 👍 |
||
| } | ||
|
|
||
| const privateIsArchivedValue = privateIsArchived ?? allReportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]?.private_isArchived; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import Parser from '@libs/Parser'; | ||
|
|
||
| describe('Parser', () => { | ||
| describe('isHTML', () => { | ||
| test('returns true for strings containing HTML tags', () => { | ||
| expect(Parser.isHTML('<b>bold</b>')).toBe(true); | ||
| expect(Parser.isHTML('<a href="https://example.com">link</a>')).toBe(true); | ||
| expect(Parser.isHTML('<h1>heading</h1>')).toBe(true); | ||
| expect(Parser.isHTML('text with <em>emphasis</em> inside')).toBe(true); | ||
| expect(Parser.isHTML('<br/>')).toBe(true); | ||
| expect(Parser.isHTML('<p>paragraph</p>')).toBe(true); | ||
| }); | ||
|
|
||
| test('returns false for plain text', () => { | ||
| expect(Parser.isHTML('just plain text')).toBe(false); | ||
| expect(Parser.isHTML('Fix the login bug')).toBe(false); | ||
| expect(Parser.isHTML('')).toBe(false); | ||
| expect(Parser.isHTML('100 > 50 and 20 < 30')).toBe(false); | ||
| }); | ||
|
|
||
| test('returns false for strings with angle brackets that are not HTML', () => { | ||
| expect(Parser.isHTML('a > b')).toBe(false); | ||
| expect(Parser.isHTML('x < y')).toBe(false); | ||
| expect(Parser.isHTML('<>')).toBe(false); | ||
| }); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.