-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: title image rendering in task preview and task view. #58555
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
a688258
30d2bbe
69cde61
3c5588c
d677123
c57b5be
8f8ad34
e48320e
f04b73d
9273f0d
726c35b
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 |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import ControlSelection from '@libs/ControlSelection'; | |
| import {canUseTouchScreen} from '@libs/DeviceCapabilities'; | ||
| import getButtonState from '@libs/getButtonState'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import Parser from '@libs/Parser'; | ||
| import {isCanceledTaskReport, isOpenTaskReport, isReportManager} from '@libs/ReportUtils'; | ||
| import type {ContextMenuAnchor} from '@pages/home/report/ContextMenu/ReportActionContextMenu'; | ||
| import CONST from '@src/CONST'; | ||
|
|
@@ -64,6 +65,9 @@ function TaskPreview({taskReportID, action, contextMenuAnchor, chatReportID, che | |
| const {translate} = useLocalize(); | ||
| const theme = useTheme(); | ||
| const [taskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`); | ||
| const taskTitle = action?.childReportName ?? taskReport?.reportName ?? ''; | ||
|
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.
@mananjadhav, I missed that initially, its now updated. We had to used |
||
|
|
||
| const taskTitleWithoutImage = Parser.replace(Parser.htmlToMarkdown(taskTitle), {disabledRules: [...CONST.TASK_TITLE_DISABLED_RULES]}); | ||
|
|
||
| // The reportAction might not contain details regarding the taskReport | ||
| // Only the direct parent reportAction will contain details about the taskReport | ||
|
|
@@ -127,7 +131,7 @@ function TaskPreview({taskReportID, action, contextMenuAnchor, chatReportID, che | |
| </UserDetailsTooltip> | ||
| )} | ||
| <View style={[styles.alignSelfCenter, styles.flex1]}> | ||
| <RenderHTML html={`<comment>${taskReport?.reportName ?? action?.childReportName ?? ''}</comment>`} /> | ||
| <RenderHTML html={`<comment>${taskTitleWithoutImage}</comment>`} /> | ||
| </View> | ||
| </View> | ||
| {shouldShowGreenDotIndicator && ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,7 +145,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret}: SearchRouterProps, | |
| { | ||
| data: [ | ||
| { | ||
| text: `${translate('search.searchIn')} ${reportForContextualSearch.text ?? reportForContextualSearch.alternateText}`, | ||
| text: StringUtils.lineBreaksToSpaces(`${translate('search.searchIn')} ${reportForContextualSearch.text ?? reportForContextualSearch.alternateText}`), | ||
|
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. Why is this needed?
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. To fix this issue where search router was displaying task reports with multiline title. Task - Task with multiline title is not displayed correctly in search list #58192 |
||
| singleIcon: Expensicons.MagnifyingGlass, | ||
| searchQuery: reportQueryValue, | ||
| autocompleteID, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4862,7 +4862,7 @@ function completeShortMention(text: string): string { | |
| * For comments shorter than or equal to 10k chars, convert the comment from MD into HTML because that's how it is stored in the database | ||
| * For longer comments, skip parsing, but still escape the text, and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!! | ||
| */ | ||
| function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAttributes?: Record<string, string>): string { | ||
| function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAttributes?: Record<string, string>, disabledRules?: string[]): string { | ||
|
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. Can these by better typed? Say
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.
|
||
| let isGroupPolicyReport = false; | ||
| if (parsingDetails?.reportID) { | ||
| const currentReport = getReportOrDraftReport(parsingDetails?.reportID); | ||
|
|
@@ -4877,11 +4877,12 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAt | |
| } | ||
|
|
||
| const textWithMention = completeShortMention(text); | ||
| const rules = disabledRules ?? []; | ||
|
|
||
| return text.length <= CONST.MAX_MARKUP_LENGTH | ||
| ? Parser.replace(textWithMention, { | ||
| shouldEscapeText: parsingDetails?.shouldEscapeText, | ||
| disabledRules: isGroupPolicyReport ? [] : ['reportMentions'], | ||
| disabledRules: isGroupPolicyReport ? [...rules] : ['reportMentions', ...rules], | ||
| extras: {mediaAttributeCache: mediaAttributes}, | ||
| }) | ||
| : lodashEscape(text); | ||
|
|
@@ -6506,7 +6507,7 @@ function buildOptimisticEditedTaskFieldReportAction({title, description}: Task): | |
| { | ||
| type: CONST.REPORT.MESSAGE.TYPE.COMMENT, | ||
| text: changelog, | ||
| html: getParsedComment(changelog), | ||
| html: getParsedComment(changelog, undefined, undefined, title !== undefined ? [...CONST.TASK_TITLE_DISABLED_RULES] : undefined), | ||
|
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. I am not sure why we want to spread (
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. The reason we spread |
||
| }, | ||
| ], | ||
| person: [ | ||
|
|
@@ -6851,7 +6852,7 @@ function buildOptimisticTaskReport( | |
|
|
||
| return { | ||
| reportID: generateReportID(), | ||
| reportName: getParsedComment(title ?? ''), | ||
| reportName: getParsedComment(title ?? '', undefined, undefined, [...CONST.TASK_TITLE_DISABLED_RULES]), | ||
| description: getParsedComment(description ?? '', {}, mediaAttributes), | ||
| ownerAccountID, | ||
| participants, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -635,7 +635,7 @@ function getCodeFontSize(isInsideH1: boolean, isInsideTaskTitle?: boolean) { | |
| return 15; | ||
| } | ||
| if (isInsideTaskTitle) { | ||
| return 19; | ||
| return 18; | ||
|
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. @Expensify/design can you confirm the value? |
||
| } | ||
| return 13; | ||
| } | ||
|
|
||
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.
display inline flex for the anchor caused an issue #90362