diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 87c8291ab05f..9f82c2000dcf 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -8,6 +8,7 @@ import compose from '../../libs/compose'; import styles from '../../styles/styles'; import ONYXKEYS from '../../ONYXKEYS'; import withLocalize, {withLocalizePropTypes} from '../withLocalize'; +import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../withCurrentUserPersonalDetails'; import Icon from '../Icon'; import CONST from '../../CONST'; import * as Expensicons from '../Icon/Expensicons'; @@ -52,9 +53,12 @@ const propTypes = { }), ...withLocalizePropTypes, + + ...withCurrentUserPersonalDetailsPropTypes, }; const defaultProps = { + ...withCurrentUserPersonalDetailsDefaultProps, personalDetailsList: {}, taskReport: {}, isHovered: false, @@ -92,7 +96,7 @@ function TaskPreview(props) { style={[styles.mr2]} containerStyle={[styles.taskCheckbox]} isChecked={isTaskCompleted} - disabled={ReportUtils.isCanceledTaskReport(props.taskReport)} + disabled={!Task.canModifyTask(props.taskReport, props.currentUserPersonalDetails.accountID)} onPress={Session.checkIfActionIsAllowed(() => { if (isTaskCompleted) { Task.reopenTask(props.taskReport); @@ -119,6 +123,7 @@ TaskPreview.displayName = 'TaskPreview'; export default compose( withLocalize, + withCurrentUserPersonalDetails, withOnyx({ taskReport: { key: ({taskReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`, diff --git a/src/components/ReportActionItem/TaskView.js b/src/components/ReportActionItem/TaskView.js index c52427ae1e8d..7cddc7a969dc 100644 --- a/src/components/ReportActionItem/TaskView.js +++ b/src/components/ReportActionItem/TaskView.js @@ -49,9 +49,8 @@ function TaskView(props) { const taskTitle = convertToLTR(props.report.reportName || ''); const isCompleted = ReportUtils.isCompletedTaskReport(props.report); const isOpen = ReportUtils.isOpenTaskReport(props.report); - const isCanceled = ReportUtils.isCanceledTaskReport(props.report); const canModifyTask = Task.canModifyTask(props.report, props.currentUserPersonalDetails.accountID); - const disableState = !canModifyTask || isCanceled; + const disableState = !canModifyTask; const isDisableInteractive = !canModifyTask || !isOpen; return ( @@ -102,7 +101,7 @@ function TaskView(props) { containerBorderRadius={8} caretSize={16} accessibilityLabel={taskTitle || props.translate('task.task')} - disabled={isCanceled || !canModifyTask} + disabled={!canModifyTask} />