From d0315ff0eff8dc7b85ecbaace62deb9cf37005b0 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Mon, 4 Sep 2023 08:53:19 +0530 Subject: [PATCH 01/16] Fix: adds fullpage not found view for completed task --- src/languages/en.js | 1 + src/languages/es.js | 1 + src/pages/tasks/TaskAssigneeSelectorModal.js | 23 +++++- src/pages/tasks/TaskDescriptionPage.js | 82 ++++++++++++++------ src/pages/tasks/TaskTitlePage.js | 70 ++++++++++++----- 5 files changed, 129 insertions(+), 48 deletions(-) diff --git a/src/languages/en.js b/src/languages/en.js index 364029a81ece..f714123fe9b0 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1421,6 +1421,7 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', + notOpen: 'Only open task can be editted', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', diff --git a/src/languages/es.js b/src/languages/es.js index 2e7ae7dd09eb..8817b8405ae3 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -1448,6 +1448,7 @@ export default { canceled: 'tarea cancelada', reopened: 'tarea reabrir', error: 'No tiene permiso para realizar la acción solicitada.', + notOpen: 'Sólo se pueden editar las tareas abiertas', }, markAsDone: 'Marcar como completada', markAsIncomplete: 'Marcar como incompleta', diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 10cb27196efd..f6df29f06264 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -17,9 +17,13 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize import compose from '../../libs/compose'; import personalDetailsPropType from '../personalDetailsPropType'; import reportPropTypes from '../reportPropTypes'; +import * as ReportUtils from '../../libs/ReportUtils'; import ROUTES from '../../ROUTES'; import * as Task from '../../libs/actions/Task'; +import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; +import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** Beta features list */ @@ -188,10 +192,23 @@ function TaskAssigneeSelectorModal(props) { } }; + const isOpen = ReportUtils.isOpenTaskReport(props.task.report); + const canModifyTask = Task.canModifyTask(props.task.report, props.currentUserPersonalDetails.accountID); + const disableState = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); + const getSubtitleKey = () => { + if (!canModifyTask) { + return 'task.messages.error'; + } + return 'task.messages.notOpen'; + }; + return ( {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( - <> + (lodashGet(props.route.params, 'reportID') ? Navigation.dismissModal() : Navigation.goBack(ROUTES.NEW_TASK))} @@ -209,7 +226,7 @@ function TaskAssigneeSelectorModal(props) { safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} /> - + )} ); @@ -221,6 +238,8 @@ TaskAssigneeSelectorModal.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, + withReportOrNotFound, withOnyx({ reports: { key: ONYXKEYS.COLLECTION.REPORT, diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index d1679ac104ce..7b0878057ae9 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -12,9 +12,13 @@ import reportPropTypes from '../reportPropTypes'; import styles from '../../styles/styles'; import compose from '../../libs/compose'; import * as Task from '../../libs/actions/Task'; +import * as ReportUtils from '../../libs/ReportUtils'; import CONST from '../../CONST'; import focusAndUpdateMultilineInputRange from '../../libs/focusAndUpdateMultilineInputRange'; import * as Browser from '../../libs/Browser'; +import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; +import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** Current user session */ @@ -48,37 +52,63 @@ function TaskDescriptionPage(props) { const inputRef = useRef(null); + const isOpen = ReportUtils.isOpenTaskReport(props.report); + const canModifyTask = Task.canModifyTask(props.report, props.currentUserPersonalDetails.accountID); + const disableState = !canModifyTask || !isOpen; + const getSubtitleKey = () => { + if (!canModifyTask) { + return 'task.messages.error'; + } + return 'task.messages.notOpen'; + }; + return ( focusAndUpdateMultilineInputRange(inputRef.current)} shouldEnableMaxHeight > - -
- - (inputRef.current = el)} - autoGrowHeight - submitOnEnter={!Browser.isMobile()} - containerStyles={[styles.autoGrowHeightMultilineInput]} - textAlignVertical="top" - /> - -
+ {({didScreenTransitionEnd}) => ( + + +
+ + { + // if we wrap the page with FullPageNotFoundView we need to explicitly handle focusing on text input + if (!el) { + return; + } + if (!inputRef.current && didScreenTransitionEnd) { + focusAndUpdateMultilineInputRange(el); + } + inputRef.current = el; + }} + autoGrowHeight + submitOnEnter={!Browser.isMobile()} + containerStyles={[styles.autoGrowHeightMultilineInput]} + textAlignVertical="top" + /> + +
+
+ )}
); } @@ -88,6 +118,8 @@ TaskDescriptionPage.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, + withReportOrNotFound, withOnyx({ session: { key: ONYXKEYS.SESSION, diff --git a/src/pages/tasks/TaskTitlePage.js b/src/pages/tasks/TaskTitlePage.js index cf0c269a6133..d724e0190ad5 100644 --- a/src/pages/tasks/TaskTitlePage.js +++ b/src/pages/tasks/TaskTitlePage.js @@ -13,7 +13,11 @@ import styles from '../../styles/styles'; import reportPropTypes from '../reportPropTypes'; import compose from '../../libs/compose'; import * as Task from '../../libs/actions/Task'; +import * as ReportUtils from '../../libs/ReportUtils'; import CONST from '../../CONST'; +import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; +import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** The report currently being looked at */ @@ -59,6 +63,15 @@ function TaskTitlePage(props) { ); const inputRef = useRef(null); + const isOpen = ReportUtils.isOpenTaskReport(props.report); + const canModifyTask = Task.canModifyTask(props.report, props.currentUserPersonalDetails.accountID); + const disableState = ReportUtils.isTaskReport(props.report) && (!canModifyTask || !isOpen); + const getSubtitleKey = () => { + if (!canModifyTask) { + return 'task.messages.error'; + } + return 'task.messages.notOpen'; + }; return ( inputRef.current && inputRef.current.focus()} shouldEnableMaxHeight > - -
- - (inputRef.current = el)} - /> - -
+ {({didScreenTransitionEnd}) => ( + + +
+ + { + if (!el) return; + if (!inputRef.current && didScreenTransitionEnd) { + inputRef.current.focus(); + } + inputRef.current = el; + }} + /> + +
+
+ )}
); } @@ -96,6 +122,8 @@ TaskTitlePage.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, + withReportOrNotFound, withOnyx({ session: { key: ONYXKEYS.SESSION, From 5321ca8d6d943e75d2413bd082b6ea48dad5ca06 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Mon, 4 Sep 2023 11:38:00 +0530 Subject: [PATCH 02/16] fixes type for edited --- src/languages/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.js b/src/languages/en.js index f714123fe9b0..90ee8ea2386b 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1421,7 +1421,7 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', - notOpen: 'Only open task can be editted', + notOpen: 'Only open task can be edited', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', From d811c6cba939f2c94db3a54df038af241c7fdacf Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Mon, 4 Sep 2023 21:29:17 +0530 Subject: [PATCH 03/16] nit: changes var names --- src/libs/Permissions.js | 2 +- src/pages/tasks/TaskAssigneeSelectorModal.js | 12 +++--------- src/pages/tasks/TaskDescriptionPage.js | 12 +++--------- src/pages/tasks/TaskTitlePage.js | 12 +++--------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index e1b51fb0f7c5..a109ac6905cb 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -7,7 +7,7 @@ import CONST from '../CONST'; * @returns {Boolean} */ function canUseAllBetas(betas) { - return _.contains(betas, CONST.BETAS.ALL); + return true; } /** diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index f6df29f06264..d21c6c42f5f1 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -194,20 +194,14 @@ function TaskAssigneeSelectorModal(props) { const isOpen = ReportUtils.isOpenTaskReport(props.task.report); const canModifyTask = Task.canModifyTask(props.task.report, props.currentUserPersonalDetails.accountID); - const disableState = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); - const getSubtitleKey = () => { - if (!canModifyTask) { - return 'task.messages.error'; - } - return 'task.messages.notOpen'; - }; + const isTaskNonEditable = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); return ( {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( { - if (!canModifyTask) { - return 'task.messages.error'; - } - return 'task.messages.notOpen'; - }; + const isTaskNonEditable = ReportUtils.isTaskReport(props.report) && (!canModifyTask || !isOpen); return ( {({didScreenTransitionEnd}) => (
{ - if (!canModifyTask) { - return 'task.messages.error'; - } - return 'task.messages.notOpen'; - }; + const isTaskNonEditable = ReportUtils.isTaskReport(props.report) && (!canModifyTask || !isOpen); return ( {({didScreenTransitionEnd}) => ( Date: Tue, 5 Sep 2023 14:53:13 +0530 Subject: [PATCH 04/16] nit: recert Permission.js --- src/libs/Permissions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index a109ac6905cb..e1b51fb0f7c5 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -7,7 +7,7 @@ import CONST from '../CONST'; * @returns {Boolean} */ function canUseAllBetas(betas) { - return true; + return _.contains(betas, CONST.BETAS.ALL); } /** From a4dc2d2e189252a8c213487816695db562c28316 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Tue, 5 Sep 2023 21:56:36 +0530 Subject: [PATCH 05/16] nit: changes message --- src/languages/en.js | 2 +- src/languages/es.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/en.js b/src/languages/en.js index 90ee8ea2386b..37837882bffa 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1421,7 +1421,7 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', - notOpen: 'Only open task can be edited', + notOpen: 'Only an open task can be edited', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', diff --git a/src/languages/es.js b/src/languages/es.js index 8817b8405ae3..8bd510e1a85e 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -1448,7 +1448,7 @@ export default { canceled: 'tarea cancelada', reopened: 'tarea reabrir', error: 'No tiene permiso para realizar la acción solicitada.', - notOpen: 'Sólo se pueden editar las tareas abiertas', + notOpen: 'Sólo se puede editar una tarea abierta', }, markAsDone: 'Marcar como completada', markAsIncomplete: 'Marcar como incompleta', From 28fbc976b99f4cf23d7abbdb8eebacb5d1e5b9a7 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Tue, 5 Sep 2023 22:05:04 +0530 Subject: [PATCH 06/16] fix: change condition --- src/pages/tasks/TaskAssigneeSelectorModal.js | 2 +- src/pages/tasks/TaskDescriptionPage.js | 2 +- src/pages/tasks/TaskTitlePage.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index d21c6c42f5f1..132588f1e1be 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -201,7 +201,7 @@ function TaskAssigneeSelectorModal(props) { {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( ( ( Date: Mon, 4 Sep 2023 08:53:19 +0530 Subject: [PATCH 07/16] Fix: adds fullpage not found view for completed task --- src/languages/en.ts | 1 + src/languages/es.ts | 1 + src/pages/tasks/TaskAssigneeSelectorModal.js | 23 +++++- src/pages/tasks/TaskDescriptionPage.js | 82 ++++++++++++++------ src/pages/tasks/TaskTitlePage.js | 70 ++++++++++++----- 5 files changed, 129 insertions(+), 48 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 79bb1300010c..5b3f2972e971 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1499,6 +1499,7 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', + notOpen: 'Only open task can be editted', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', diff --git a/src/languages/es.ts b/src/languages/es.ts index 0252fce3a421..69970f983972 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1529,6 +1529,7 @@ export default { canceled: 'tarea cancelada', reopened: 'tarea reabrir', error: 'No tiene permiso para realizar la acción solicitada.', + notOpen: 'Sólo se pueden editar las tareas abiertas', }, markAsDone: 'Marcar como completada', markAsIncomplete: 'Marcar como incompleta', diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 10cb27196efd..f6df29f06264 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -17,9 +17,13 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize import compose from '../../libs/compose'; import personalDetailsPropType from '../personalDetailsPropType'; import reportPropTypes from '../reportPropTypes'; +import * as ReportUtils from '../../libs/ReportUtils'; import ROUTES from '../../ROUTES'; import * as Task from '../../libs/actions/Task'; +import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; +import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** Beta features list */ @@ -188,10 +192,23 @@ function TaskAssigneeSelectorModal(props) { } }; + const isOpen = ReportUtils.isOpenTaskReport(props.task.report); + const canModifyTask = Task.canModifyTask(props.task.report, props.currentUserPersonalDetails.accountID); + const disableState = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); + const getSubtitleKey = () => { + if (!canModifyTask) { + return 'task.messages.error'; + } + return 'task.messages.notOpen'; + }; + return ( {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( - <> + (lodashGet(props.route.params, 'reportID') ? Navigation.dismissModal() : Navigation.goBack(ROUTES.NEW_TASK))} @@ -209,7 +226,7 @@ function TaskAssigneeSelectorModal(props) { safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} /> - + )} ); @@ -221,6 +238,8 @@ TaskAssigneeSelectorModal.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, + withReportOrNotFound, withOnyx({ reports: { key: ONYXKEYS.COLLECTION.REPORT, diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index d1679ac104ce..7b0878057ae9 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -12,9 +12,13 @@ import reportPropTypes from '../reportPropTypes'; import styles from '../../styles/styles'; import compose from '../../libs/compose'; import * as Task from '../../libs/actions/Task'; +import * as ReportUtils from '../../libs/ReportUtils'; import CONST from '../../CONST'; import focusAndUpdateMultilineInputRange from '../../libs/focusAndUpdateMultilineInputRange'; import * as Browser from '../../libs/Browser'; +import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; +import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** Current user session */ @@ -48,37 +52,63 @@ function TaskDescriptionPage(props) { const inputRef = useRef(null); + const isOpen = ReportUtils.isOpenTaskReport(props.report); + const canModifyTask = Task.canModifyTask(props.report, props.currentUserPersonalDetails.accountID); + const disableState = !canModifyTask || !isOpen; + const getSubtitleKey = () => { + if (!canModifyTask) { + return 'task.messages.error'; + } + return 'task.messages.notOpen'; + }; + return ( focusAndUpdateMultilineInputRange(inputRef.current)} shouldEnableMaxHeight > - - - - (inputRef.current = el)} - autoGrowHeight - submitOnEnter={!Browser.isMobile()} - containerStyles={[styles.autoGrowHeightMultilineInput]} - textAlignVertical="top" - /> - - + {({didScreenTransitionEnd}) => ( + + +
+ + { + // if we wrap the page with FullPageNotFoundView we need to explicitly handle focusing on text input + if (!el) { + return; + } + if (!inputRef.current && didScreenTransitionEnd) { + focusAndUpdateMultilineInputRange(el); + } + inputRef.current = el; + }} + autoGrowHeight + submitOnEnter={!Browser.isMobile()} + containerStyles={[styles.autoGrowHeightMultilineInput]} + textAlignVertical="top" + /> + +
+
+ )}
); } @@ -88,6 +118,8 @@ TaskDescriptionPage.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, + withReportOrNotFound, withOnyx({ session: { key: ONYXKEYS.SESSION, diff --git a/src/pages/tasks/TaskTitlePage.js b/src/pages/tasks/TaskTitlePage.js index cf0c269a6133..d724e0190ad5 100644 --- a/src/pages/tasks/TaskTitlePage.js +++ b/src/pages/tasks/TaskTitlePage.js @@ -13,7 +13,11 @@ import styles from '../../styles/styles'; import reportPropTypes from '../reportPropTypes'; import compose from '../../libs/compose'; import * as Task from '../../libs/actions/Task'; +import * as ReportUtils from '../../libs/ReportUtils'; import CONST from '../../CONST'; +import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; +import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** The report currently being looked at */ @@ -59,6 +63,15 @@ function TaskTitlePage(props) { ); const inputRef = useRef(null); + const isOpen = ReportUtils.isOpenTaskReport(props.report); + const canModifyTask = Task.canModifyTask(props.report, props.currentUserPersonalDetails.accountID); + const disableState = ReportUtils.isTaskReport(props.report) && (!canModifyTask || !isOpen); + const getSubtitleKey = () => { + if (!canModifyTask) { + return 'task.messages.error'; + } + return 'task.messages.notOpen'; + }; return ( inputRef.current && inputRef.current.focus()} shouldEnableMaxHeight > - -
- - (inputRef.current = el)} - /> - -
+ {({didScreenTransitionEnd}) => ( + + +
+ + { + if (!el) return; + if (!inputRef.current && didScreenTransitionEnd) { + inputRef.current.focus(); + } + inputRef.current = el; + }} + /> + +
+
+ )}
); } @@ -96,6 +122,8 @@ TaskTitlePage.defaultProps = defaultProps; export default compose( withLocalize, + withCurrentUserPersonalDetails, + withReportOrNotFound, withOnyx({ session: { key: ONYXKEYS.SESSION, From c8cb89dc7e5c24fd0a06fb6fa5ca9c554e22e20f Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Mon, 4 Sep 2023 11:38:00 +0530 Subject: [PATCH 08/16] fixes type for edited --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 5b3f2972e971..bbe538f504bc 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1499,7 +1499,7 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', - notOpen: 'Only open task can be editted', + notOpen: 'Only open task can be edited', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', From 33f7a7a24abfeb1718f3d0da9c6d24d07e065d24 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Mon, 4 Sep 2023 21:29:17 +0530 Subject: [PATCH 09/16] nit: changes var names --- src/libs/Permissions.js | 2 +- src/pages/tasks/TaskAssigneeSelectorModal.js | 12 +++--------- src/pages/tasks/TaskDescriptionPage.js | 12 +++--------- src/pages/tasks/TaskTitlePage.js | 12 +++--------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index f37cd5bb5bf3..471805daff6c 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -7,7 +7,7 @@ import CONST from '../CONST'; * @returns {Boolean} */ function canUseAllBetas(betas) { - return _.contains(betas, CONST.BETAS.ALL); + return true; } /** diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index f6df29f06264..d21c6c42f5f1 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -194,20 +194,14 @@ function TaskAssigneeSelectorModal(props) { const isOpen = ReportUtils.isOpenTaskReport(props.task.report); const canModifyTask = Task.canModifyTask(props.task.report, props.currentUserPersonalDetails.accountID); - const disableState = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); - const getSubtitleKey = () => { - if (!canModifyTask) { - return 'task.messages.error'; - } - return 'task.messages.notOpen'; - }; + const isTaskNonEditable = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); return ( {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( { - if (!canModifyTask) { - return 'task.messages.error'; - } - return 'task.messages.notOpen'; - }; + const isTaskNonEditable = ReportUtils.isTaskReport(props.report) && (!canModifyTask || !isOpen); return ( {({didScreenTransitionEnd}) => (
{ - if (!canModifyTask) { - return 'task.messages.error'; - } - return 'task.messages.notOpen'; - }; + const isTaskNonEditable = ReportUtils.isTaskReport(props.report) && (!canModifyTask || !isOpen); return ( {({didScreenTransitionEnd}) => ( Date: Tue, 5 Sep 2023 14:53:13 +0530 Subject: [PATCH 10/16] nit: recert Permission.js --- src/libs/Permissions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index 471805daff6c..f37cd5bb5bf3 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -7,7 +7,7 @@ import CONST from '../CONST'; * @returns {Boolean} */ function canUseAllBetas(betas) { - return true; + return _.contains(betas, CONST.BETAS.ALL); } /** From 3b454c1759f38a7c03a298dcfccd8dce472ead74 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Tue, 5 Sep 2023 21:56:36 +0530 Subject: [PATCH 11/16] nit: changes message --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index bbe538f504bc..08091ed70b2f 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1499,7 +1499,7 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', - notOpen: 'Only open task can be edited', + notOpen: 'Only an open task can be edited', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', diff --git a/src/languages/es.ts b/src/languages/es.ts index 69970f983972..2d5b60d2b72e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1529,7 +1529,7 @@ export default { canceled: 'tarea cancelada', reopened: 'tarea reabrir', error: 'No tiene permiso para realizar la acción solicitada.', - notOpen: 'Sólo se pueden editar las tareas abiertas', + notOpen: 'Sólo se puede editar una tarea abierta', }, markAsDone: 'Marcar como completada', markAsIncomplete: 'Marcar como incompleta', From f95864839162fa0f3fcab2c37b81dbfef20f9197 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Tue, 5 Sep 2023 22:05:04 +0530 Subject: [PATCH 12/16] fix: change condition --- src/pages/tasks/TaskAssigneeSelectorModal.js | 2 +- src/pages/tasks/TaskDescriptionPage.js | 2 +- src/pages/tasks/TaskTitlePage.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index d21c6c42f5f1..132588f1e1be 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -201,7 +201,7 @@ function TaskAssigneeSelectorModal(props) { {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( ( ( Date: Wed, 6 Sep 2023 00:16:40 +0530 Subject: [PATCH 13/16] removes subtitle key --- src/languages/en.ts | 1 - src/languages/es.ts | 1 - src/pages/tasks/TaskAssigneeSelectorModal.js | 5 +---- src/pages/tasks/TaskDescriptionPage.js | 5 +---- src/pages/tasks/TaskTitlePage.js | 5 +---- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 08091ed70b2f..79bb1300010c 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1499,7 +1499,6 @@ export default { canceled: 'canceled task', reopened: 'reopened task', error: 'You do not have the permission to do the requested action.', - notOpen: 'Only an open task can be edited', }, markAsDone: 'Mark as done', markAsIncomplete: 'Mark as incomplete', diff --git a/src/languages/es.ts b/src/languages/es.ts index 2d5b60d2b72e..0252fce3a421 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1529,7 +1529,6 @@ export default { canceled: 'tarea cancelada', reopened: 'tarea reabrir', error: 'No tiene permiso para realizar la acción solicitada.', - notOpen: 'Sólo se puede editar una tarea abierta', }, markAsDone: 'Marcar como completada', markAsIncomplete: 'Marcar como incompleta', diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 132588f1e1be..8eb8a736430d 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -199,10 +199,7 @@ function TaskAssigneeSelectorModal(props) { return ( {({didScreenTransitionEnd, safeAreaPaddingBottomStyle}) => ( - + (lodashGet(props.route.params, 'reportID') ? Navigation.dismissModal() : Navigation.goBack(ROUTES.NEW_TASK))} diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 1631d70e6293..f9e5a37a7114 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -63,10 +63,7 @@ function TaskDescriptionPage(props) { shouldEnableMaxHeight > {({didScreenTransitionEnd}) => ( - + {({didScreenTransitionEnd}) => ( - + Date: Wed, 6 Sep 2023 20:03:23 +0530 Subject: [PATCH 14/16] fix: add check for new task --- src/pages/tasks/TaskAssigneeSelectorModal.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index 8eb8a736430d..533c47137176 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -23,7 +23,6 @@ import ROUTES from '../../ROUTES'; import * as Task from '../../libs/actions/Task'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; -import withReportOrNotFound from '../home/report/withReportOrNotFound'; const propTypes = { /** Beta features list */ @@ -194,7 +193,7 @@ function TaskAssigneeSelectorModal(props) { const isOpen = ReportUtils.isOpenTaskReport(props.task.report); const canModifyTask = Task.canModifyTask(props.task.report, props.currentUserPersonalDetails.accountID); - const isTaskNonEditable = ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); + const isTaskNonEditable = report && ReportUtils.isTaskReport(props.task.report) && (!canModifyTask || !isOpen); return ( @@ -230,7 +229,6 @@ TaskAssigneeSelectorModal.defaultProps = defaultProps; export default compose( withLocalize, withCurrentUserPersonalDetails, - withReportOrNotFound, withOnyx({ reports: { key: ONYXKEYS.COLLECTION.REPORT, From c32e13d13ba6474907617b3794d28e899403c321 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Tue, 12 Sep 2023 23:14:14 +0530 Subject: [PATCH 15/16] fix: update the branch --- src/pages/tasks/TaskAssigneeSelectorModal.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js index be58c3ab8f57..7e5ab63bdddf 100644 --- a/src/pages/tasks/TaskAssigneeSelectorModal.js +++ b/src/pages/tasks/TaskAssigneeSelectorModal.js @@ -19,7 +19,6 @@ import personalDetailsPropType from '../personalDetailsPropType'; import reportPropTypes from '../reportPropTypes'; import * as ReportUtils from '../../libs/ReportUtils'; import ROUTES from '../../ROUTES'; -import * as ReportUtils from '../../libs/ReportUtils'; import * as Task from '../../libs/actions/Task'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; import withCurrentUserPersonalDetails from '../../components/withCurrentUserPersonalDetails'; From ee095a75f235189207bf5286849957ea7ab87f37 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Tue, 12 Sep 2023 23:22:47 +0530 Subject: [PATCH 16/16] fix: title page after merging changes --- src/pages/tasks/TaskTitlePage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/tasks/TaskTitlePage.js b/src/pages/tasks/TaskTitlePage.js index ea576445407e..9a7a36a1e119 100644 --- a/src/pages/tasks/TaskTitlePage.js +++ b/src/pages/tasks/TaskTitlePage.js @@ -102,7 +102,7 @@ function TaskTitlePage(props) { ref={(el) => { if (!el) return; if (!inputRef.current && didScreenTransitionEnd) { - inputRef.current.focus(); + el.focus(); } inputRef.current = el; }}