From 8c5cf6dfd374dd428fa070facc60cabf32e870e1 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Tue, 10 Oct 2023 10:48:47 +0700 Subject: [PATCH 01/15] fix task description does not remove empty quotes --- src/pages/tasks/NewTaskDescriptionPage.js | 8 ++++++-- src/pages/tasks/NewTaskDetailsPage.js | 9 +++++++-- src/pages/tasks/NewTaskPage.js | 5 ++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index 44fd4346538d..ce8a46c59151 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -3,6 +3,7 @@ import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import {useFocusEffect} from '@react-navigation/native'; import PropTypes from 'prop-types'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; @@ -39,6 +40,8 @@ const defaultProps = { }, }; +const parser = new ExpensiMark(); + function NewTaskDescriptionPage(props) { const inputRef = useRef(null); const focusTimeoutRef = useRef(null); @@ -62,7 +65,8 @@ function NewTaskDescriptionPage(props) { ); const onSubmit = (values) => { - Task.setDescriptionValue(values.taskDescription); + const parsedTaskDescription = parser.replace(values.taskDescription); + Task.setDescriptionValue(parsedTaskDescription); Navigation.goBack(ROUTES.NEW_TASK); }; @@ -91,7 +95,7 @@ function NewTaskDescriptionPage(props) { > { setTaskTitle(props.task.title); - setTaskDescription(props.task.description || ''); + setTaskDescription(parser.htmlToMarkdown(props.task.description || '')); }, [props.task]); /** @@ -64,7 +67,8 @@ function NewTaskDetailsPage(props) { // On submit, we want to call the assignTask function and wait to validate // the response function onSubmit(values) { - Task.setDetailsValue(values.taskTitle, values.taskDescription); + const parsedTaskDescription = parser.replace(values.taskDescription); + Task.setDetailsValue(values.taskTitle, parsedTaskDescription); Navigation.navigate(ROUTES.NEW_TASK); } @@ -114,6 +118,7 @@ function NewTaskDetailsPage(props) { submitOnEnter={!Browser.isMobile()} containerStyles={[styles.autoGrowHeightMultilineInput]} textAlignVertical="top" + defaultValue={parser.htmlToMarkdown(taskDescription)} value={taskDescription} onValueChange={(value) => setTaskDescription(value)} /> diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 790bd6ceeb64..5fe1685cdef7 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -4,6 +4,7 @@ import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; @@ -61,6 +62,7 @@ const defaultProps = { personalDetails: {}, reports: {}, }; +const parser = new ExpensiMark(); function NewTaskPage(props) { const [assignee, setAssignee] = useState({}); @@ -129,7 +131,7 @@ function NewTaskPage(props) { Task.createTaskAndNavigate( parentReport.reportID, props.task.title, - props.task.description, + parser.htmlToMarkdown(props.task.description || ''), props.task.assignee, props.task.assigneeAccountID, props.task.assigneeChatReport, @@ -177,6 +179,7 @@ function NewTaskPage(props) { shouldParseTitle numberOfLinesTitle={2} titleStyle={styles.flex1} + shouldRenderAsHTML /> Date: Tue, 10 Oct 2023 11:03:30 +0700 Subject: [PATCH 02/15] fix bug when save description --- src/pages/tasks/TaskDescriptionPage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index be2cdad03fe6..0ba65c5921c4 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import {View} from 'react-native'; import {useFocusEffect} from '@react-navigation/native'; import {withOnyx} from 'react-native-onyx'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import ScreenWrapper from '../../components/ScreenWrapper'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; @@ -40,6 +41,7 @@ const defaultProps = { report: {}, }; +const parser = new ExpensiMark(); function TaskDescriptionPage(props) { const validate = useCallback(() => ({}), []); @@ -103,7 +105,7 @@ function TaskDescriptionPage(props) { name="description" label={props.translate('newTaskPage.descriptionOptional')} accessibilityLabel={props.translate('newTaskPage.descriptionOptional')} - defaultValue={(props.report && props.report.description) || ''} + defaultValue={parser.htmlToMarkdown((props.report && parser.replace(props.report.description)) || '')} ref={(el) => { if (!el) { return; From 47e4904a46f661fb50354b217932343bc38b8197 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Tue, 10 Oct 2023 22:14:57 +0700 Subject: [PATCH 03/15] fix update the logic --- src/pages/PrivateNotes/PrivateNotesViewPage.js | 2 +- src/pages/tasks/NewTaskDescriptionPage.js | 5 ++--- src/pages/tasks/NewTaskDetailsPage.js | 8 ++++---- src/pages/tasks/NewTaskPage.js | 6 ++---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/pages/PrivateNotes/PrivateNotesViewPage.js b/src/pages/PrivateNotes/PrivateNotesViewPage.js index 6550c9d7d3c3..09fe3455afb7 100644 --- a/src/pages/PrivateNotes/PrivateNotesViewPage.js +++ b/src/pages/PrivateNotes/PrivateNotesViewPage.js @@ -85,7 +85,7 @@ function PrivateNotesViewPage({route, personalDetailsList, session, report}) { isCurrentUserNote && Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, route.params.accountID))} shouldShowRightIcon={isCurrentUserNote} diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index ce8a46c59151..aedb4ca284db 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -65,8 +65,7 @@ function NewTaskDescriptionPage(props) { ); const onSubmit = (values) => { - const parsedTaskDescription = parser.replace(values.taskDescription); - Task.setDescriptionValue(parsedTaskDescription); + Task.setDescriptionValue(values.taskDescription); Navigation.goBack(ROUTES.NEW_TASK); }; @@ -95,7 +94,7 @@ function NewTaskDescriptionPage(props) { > { setTaskTitle(props.task.title); - setTaskDescription(parser.htmlToMarkdown(props.task.description || '')); + setTaskDescription(parser.htmlToMarkdown(parser.replace(props.task.description || ''))); }, [props.task]); /** @@ -67,8 +68,7 @@ function NewTaskDetailsPage(props) { // On submit, we want to call the assignTask function and wait to validate // the response function onSubmit(values) { - const parsedTaskDescription = parser.replace(values.taskDescription); - Task.setDetailsValue(values.taskTitle, parsedTaskDescription); + Task.setDetailsValue(values.taskTitle, values.taskDescription); Navigation.navigate(ROUTES.NEW_TASK); } @@ -118,7 +118,7 @@ function NewTaskDetailsPage(props) { submitOnEnter={!Browser.isMobile()} containerStyles={[styles.autoGrowHeightMultilineInput]} textAlignVertical="top" - defaultValue={parser.htmlToMarkdown(taskDescription)} + defaultValue={parser.htmlToMarkdown(parser.replace(taskDescription))} value={taskDescription} onValueChange={(value) => setTaskDescription(value)} /> diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 5fe1685cdef7..8635d8378811 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -71,7 +71,6 @@ function NewTaskPage(props) { const [description, setDescription] = useState(''); const [errorMessage, setErrorMessage] = useState(''); const [parentReport, setParentReport] = useState({}); - const isAllowedToCreateTask = useMemo(() => _.isEmpty(parentReport) || ReportUtils.isAllowedToComment(parentReport), [parentReport]); useEffect(() => { @@ -131,7 +130,7 @@ function NewTaskPage(props) { Task.createTaskAndNavigate( parentReport.reportID, props.task.title, - parser.htmlToMarkdown(props.task.description || ''), + props.task.description, props.task.assignee, props.task.assigneeAccountID, props.task.assigneeChatReport, @@ -173,13 +172,12 @@ function NewTaskPage(props) { /> Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)} shouldShowRightIcon shouldParseTitle numberOfLinesTitle={2} titleStyle={styles.flex1} - shouldRenderAsHTML /> Date: Tue, 10 Oct 2023 22:15:42 +0700 Subject: [PATCH 04/15] fix remove redundant code --- src/pages/PrivateNotes/PrivateNotesViewPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/PrivateNotes/PrivateNotesViewPage.js b/src/pages/PrivateNotes/PrivateNotesViewPage.js index 09fe3455afb7..6550c9d7d3c3 100644 --- a/src/pages/PrivateNotes/PrivateNotesViewPage.js +++ b/src/pages/PrivateNotes/PrivateNotesViewPage.js @@ -85,7 +85,7 @@ function PrivateNotesViewPage({route, personalDetailsList, session, report}) { isCurrentUserNote && Navigation.navigate(ROUTES.PRIVATE_NOTES_EDIT.getRoute(report.reportID, route.params.accountID))} shouldShowRightIcon={isCurrentUserNote} From 9797b1f126fda336eae1b0c5df81372b4f762933 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Tue, 10 Oct 2023 22:23:23 +0700 Subject: [PATCH 05/15] fix lint --- src/pages/tasks/NewTaskDetailsPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/tasks/NewTaskDetailsPage.js b/src/pages/tasks/NewTaskDetailsPage.js index 21131a36b69d..29e1c80c5062 100644 --- a/src/pages/tasks/NewTaskDetailsPage.js +++ b/src/pages/tasks/NewTaskDetailsPage.js @@ -18,7 +18,6 @@ import ROUTES from '../../ROUTES'; import * as Task from '../../libs/actions/Task'; import CONST from '../../CONST'; import * as Browser from '../../libs/Browser'; -import {useFocusEffect} from '@react-navigation/native'; const propTypes = { /** Beta features list */ From c8aeb9b571cd6140e209cb50bf136ff3efb76a51 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 11 Oct 2023 01:12:59 +0700 Subject: [PATCH 06/15] fix android issue whenn displaying desc --- src/components/ReportActionItem/TaskView.js | 6 ++++-- src/pages/tasks/NewTaskPage.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index 7cddc7a969dc..dd5e09478e4f 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -2,6 +2,7 @@ import React, {useEffect} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import reportPropTypes from '../../pages/reportPropTypes'; import withLocalize, {withLocalizePropTypes} from '../withLocalize'; import withWindowDimensions from '../withWindowDimensions'; @@ -40,7 +41,7 @@ const propTypes = { ...withCurrentUserPersonalDetailsPropTypes, }; - +const parser = new ExpensiMark(); function TaskView(props) { useEffect(() => { Task.setTaskReport({...props.report}); @@ -130,7 +131,7 @@ function TaskView(props) { Navigation.navigate(ROUTES.TASK_DESCRIPTION.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} @@ -138,6 +139,7 @@ function TaskView(props) { shouldGreyOutWhenDisabled={false} numberOfLinesTitle={0} interactive={!isDisableInteractive} + shouldRenderAsHTML /> {props.report.managerID ? ( diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 8635d8378811..441a0a3ec276 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -172,10 +172,10 @@ function NewTaskPage(props) { /> Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)} shouldShowRightIcon - shouldParseTitle + shouldRenderAsHTML numberOfLinesTitle={2} titleStyle={styles.flex1} /> From 8224acd52880748b1eb2db138759d5c99bfb18fe Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 11 Oct 2023 14:43:49 +0700 Subject: [PATCH 07/15] fix revert logic fixing display description --- src/components/ReportActionItem/TaskView.js | 6 ++---- src/pages/tasks/NewTaskPage.js | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index dd5e09478e4f..7cddc7a969dc 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -2,7 +2,6 @@ import React, {useEffect} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import reportPropTypes from '../../pages/reportPropTypes'; import withLocalize, {withLocalizePropTypes} from '../withLocalize'; import withWindowDimensions from '../withWindowDimensions'; @@ -41,7 +40,7 @@ const propTypes = { ...withCurrentUserPersonalDetailsPropTypes, }; -const parser = new ExpensiMark(); + function TaskView(props) { useEffect(() => { Task.setTaskReport({...props.report}); @@ -131,7 +130,7 @@ function TaskView(props) { Navigation.navigate(ROUTES.TASK_DESCRIPTION.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} @@ -139,7 +138,6 @@ function TaskView(props) { shouldGreyOutWhenDisabled={false} numberOfLinesTitle={0} interactive={!isDisableInteractive} - shouldRenderAsHTML /> {props.report.managerID ? ( diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 441a0a3ec276..bb87e4b053d6 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -4,7 +4,6 @@ import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; import HeaderWithBackButton from '../../components/HeaderWithBackButton'; @@ -62,7 +61,6 @@ const defaultProps = { personalDetails: {}, reports: {}, }; -const parser = new ExpensiMark(); function NewTaskPage(props) { const [assignee, setAssignee] = useState({}); @@ -172,10 +170,9 @@ function NewTaskPage(props) { /> Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)} shouldShowRightIcon - shouldRenderAsHTML numberOfLinesTitle={2} titleStyle={styles.flex1} /> From cf07ccb63a67fc22b06fa8e446937a7269528326 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 11 Oct 2023 14:46:32 +0700 Subject: [PATCH 08/15] fix revert all related to display description --- src/pages/tasks/NewTaskPage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index bb87e4b053d6..790bd6ceeb64 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -69,6 +69,7 @@ function NewTaskPage(props) { const [description, setDescription] = useState(''); const [errorMessage, setErrorMessage] = useState(''); const [parentReport, setParentReport] = useState({}); + const isAllowedToCreateTask = useMemo(() => _.isEmpty(parentReport) || ReportUtils.isAllowedToComment(parentReport), [parentReport]); useEffect(() => { @@ -173,6 +174,7 @@ function NewTaskPage(props) { title={description} onPress={() => Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)} shouldShowRightIcon + shouldParseTitle numberOfLinesTitle={2} titleStyle={styles.flex1} /> From 2e68ecb919878b7c451cbf52559ff246aa143c12 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Fri, 3 Nov 2023 23:31:44 +0700 Subject: [PATCH 09/15] fix sending html to BE --- src/pages/tasks/NewTaskDescriptionPage.js | 6 +++--- src/pages/tasks/NewTaskDetailsPage.js | 12 ++++++------ src/pages/tasks/NewTaskPage.js | 5 +++-- src/pages/tasks/TaskDescriptionPage.js | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index 7047a7b9d823..e8998a30ad8c 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -1,8 +1,8 @@ +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FormProvider from '@components/Form/FormProvider'; import InputWrapperWithRef from '@components/Form/InputWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -47,7 +47,7 @@ function NewTaskDescriptionPage(props) { const {inputCallbackRef} = useAutoFocusInput(); const onSubmit = (values) => { - Task.setDescriptionValue(values.taskDescription); + Task.setDescriptionValue(parser.htmlToMarkdown(parser.replace(values.taskDescription))); Navigation.goBack(ROUTES.NEW_TASK); }; @@ -77,7 +77,7 @@ function NewTaskDescriptionPage(props) { { setTaskTitle(props.task.title); - setTaskDescription(parser.htmlToMarkdown(parser.replace(props.task.description || ''))); - }, [props.task]); + setTaskDescription(props.task.description || ''); + }, [props.task, isFocused]); /** * @param {Object} values - form input values passed by the Form component @@ -70,7 +71,7 @@ function NewTaskDetailsPage(props) { // On submit, we want to call the assignTask function and wait to validate // the response function onSubmit(values) { - Task.setDetailsValue(values.taskTitle, values.taskDescription); + Task.setDetailsValue(values.taskTitle, parser.htmlToMarkdown(parser.replace(values.taskDescription))); Navigation.navigate(ROUTES.NEW_TASK); } @@ -121,7 +122,6 @@ function NewTaskDetailsPage(props) { submitOnEnter={!Browser.isMobile()} containerStyles={[styles.autoGrowHeightMultilineInput]} textAlignVertical="top" - defaultValue={parser.htmlToMarkdown(parser.replace(taskDescription))} value={taskDescription} onValueChange={(value) => setTaskDescription(value)} /> diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 41cda42ccbd8..3979fba86eb8 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -1,3 +1,4 @@ +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useEffect, useMemo, useState} from 'react'; @@ -127,11 +128,11 @@ function NewTaskPage(props) { setErrorMessage(props.translate('newTaskPage.pleaseEnterTaskDestination')); return; } - + const parser = new ExpensiMark(); Task.createTaskAndNavigate( parentReport.reportID, props.task.title, - props.task.description, + parser.replace(props.task.description), props.task.assignee, props.task.assigneeAccountID, props.task.assigneeChatReport, diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 9a1b9e4ef6f1..0e4e791a8999 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -1,8 +1,8 @@ import {useFocusEffect} from '@react-navigation/native'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import React, {useCallback, useRef} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; @@ -43,7 +43,7 @@ function TaskDescriptionPage(props) { (values) => { // Set the description of the report in the store and then call Task.editTaskReport // to update the description of the report on the server - Task.editTaskAndNavigate(props.report, {description: values.description}); + Task.editTaskAndNavigate(props.report, {description: parser.replace(values.description)}); }, [props], ); From 2ab9dbf5191af194785cdaee055f91224e6e7f73 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Fri, 3 Nov 2023 23:51:14 +0700 Subject: [PATCH 10/15] fix display task view issue --- src/components/ReportActionItem/TaskView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index 9aa85392dde7..478e1c6b3607 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -130,9 +130,9 @@ function TaskView(props) { Navigation.navigate(ROUTES.TASK_DESCRIPTION.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} From 2dd8668f525773014b0ed8c303fb38217978a927 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 16 Nov 2023 09:20:22 +0700 Subject: [PATCH 11/15] fix app crash when clicking on IOU --- src/components/ReportActionItem/MoneyRequestView.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index 5b9a1b2212c7..a95ba3423a08 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -22,6 +22,7 @@ import compose from '@libs/compose'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; +import Permissions from '@libs/Permissions'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReceiptUtils from '@libs/ReceiptUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; From 2bb69aa4c0f4bf64b2afbf68e27499dd4d3536c7 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 16 Nov 2023 09:49:06 +0700 Subject: [PATCH 12/15] fix revert fix display task view issue --- src/components/ReportActionItem/TaskView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index 478e1c6b3607..9aa85392dde7 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -130,9 +130,9 @@ function TaskView(props) { Navigation.navigate(ROUTES.TASK_DESCRIPTION.getRoute(props.report.reportID))} shouldShowRightIcon={isOpen} disabled={disableState} From b4cdfa24277eec7d53d731fa7a0e76304b5c1120 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 16 Nov 2023 09:54:12 +0700 Subject: [PATCH 13/15] fix revert sending html to BE --- src/pages/tasks/NewTaskDescriptionPage.js | 6 +++--- src/pages/tasks/NewTaskDetailsPage.js | 12 ++++++------ src/pages/tasks/NewTaskPage.js | 5 ++--- src/pages/tasks/TaskDescriptionPage.js | 4 ++-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index e8998a30ad8c..7047a7b9d823 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -1,8 +1,8 @@ -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FormProvider from '@components/Form/FormProvider'; import InputWrapperWithRef from '@components/Form/InputWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -47,7 +47,7 @@ function NewTaskDescriptionPage(props) { const {inputCallbackRef} = useAutoFocusInput(); const onSubmit = (values) => { - Task.setDescriptionValue(parser.htmlToMarkdown(parser.replace(values.taskDescription))); + Task.setDescriptionValue(values.taskDescription); Navigation.goBack(ROUTES.NEW_TASK); }; @@ -77,7 +77,7 @@ function NewTaskDescriptionPage(props) { { setTaskTitle(props.task.title); - setTaskDescription(props.task.description || ''); - }, [props.task, isFocused]); + setTaskDescription(parser.htmlToMarkdown(parser.replace(props.task.description || ''))); + }, [props.task]); /** * @param {Object} values - form input values passed by the Form component @@ -71,7 +70,7 @@ function NewTaskDetailsPage(props) { // On submit, we want to call the assignTask function and wait to validate // the response function onSubmit(values) { - Task.setDetailsValue(values.taskTitle, parser.htmlToMarkdown(parser.replace(values.taskDescription))); + Task.setDetailsValue(values.taskTitle, values.taskDescription); Navigation.navigate(ROUTES.NEW_TASK); } @@ -122,6 +121,7 @@ function NewTaskDetailsPage(props) { submitOnEnter={!Browser.isMobile()} containerStyles={[styles.autoGrowHeightMultilineInput]} textAlignVertical="top" + defaultValue={parser.htmlToMarkdown(parser.replace(taskDescription))} value={taskDescription} onValueChange={(value) => setTaskDescription(value)} /> diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 3979fba86eb8..41cda42ccbd8 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -1,4 +1,3 @@ -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useEffect, useMemo, useState} from 'react'; @@ -128,11 +127,11 @@ function NewTaskPage(props) { setErrorMessage(props.translate('newTaskPage.pleaseEnterTaskDestination')); return; } - const parser = new ExpensiMark(); + Task.createTaskAndNavigate( parentReport.reportID, props.task.title, - parser.replace(props.task.description), + props.task.description, props.task.assignee, props.task.assigneeAccountID, props.task.assigneeChatReport, diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 0e4e791a8999..9a1b9e4ef6f1 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -1,8 +1,8 @@ import {useFocusEffect} from '@react-navigation/native'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import React, {useCallback, useRef} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; @@ -43,7 +43,7 @@ function TaskDescriptionPage(props) { (values) => { // Set the description of the report in the store and then call Task.editTaskReport // to update the description of the report on the server - Task.editTaskAndNavigate(props.report, {description: parser.replace(values.description)}); + Task.editTaskAndNavigate(props.report, {description: values.description}); }, [props], ); From fb32496be85673761d01e7d48b9a058106699d25 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 16 Nov 2023 10:07:23 +0700 Subject: [PATCH 14/15] fix lint --- src/pages/tasks/NewTaskDescriptionPage.js | 2 +- src/pages/tasks/NewTaskDetailsPage.js | 2 +- src/pages/tasks/TaskDescriptionPage.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index fd8e881c7993..b70186944ccd 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -1,8 +1,8 @@ +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FormProvider from '@components/Form/FormProvider'; import InputWrapperWithRef from '@components/Form/InputWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; diff --git a/src/pages/tasks/NewTaskDetailsPage.js b/src/pages/tasks/NewTaskDetailsPage.js index 5d0f20489c65..ecfae98584e6 100644 --- a/src/pages/tasks/NewTaskDetailsPage.js +++ b/src/pages/tasks/NewTaskDetailsPage.js @@ -1,8 +1,8 @@ +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import PropTypes from 'prop-types'; import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index e33bc4b398e3..fb1322bdaf05 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -1,8 +1,8 @@ import {useFocusEffect} from '@react-navigation/native'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import React, {useCallback, useRef} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; -import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; From 31f2dc6c72acebcc94682148802028f7290a896d Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Thu, 16 Nov 2023 11:13:16 +0700 Subject: [PATCH 15/15] fix remove unrelated change --- src/components/ReportActionItem/MoneyRequestView.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js index a95ba3423a08..5b9a1b2212c7 100644 --- a/src/components/ReportActionItem/MoneyRequestView.js +++ b/src/components/ReportActionItem/MoneyRequestView.js @@ -22,7 +22,6 @@ import compose from '@libs/compose'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; -import Permissions from '@libs/Permissions'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReceiptUtils from '@libs/ReceiptUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils';