From 8fcb1334787005429941dc03e9c7b18153c6bed1 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Mon, 9 Dec 2024 16:02:00 +0530 Subject: [PATCH 01/21] fix: Make all task titles/descriptions read-only to all but the author/assignee. Signed-off-by: krishna2323 --- .../ReportActionItem/TaskPreview.tsx | 6 ++-- src/components/ReportActionItem/TaskView.tsx | 6 ++-- src/components/TaskHeaderActionButton.tsx | 2 +- src/libs/actions/Task.ts | 32 +++++++------------ src/pages/ReportDetailsPage.tsx | 2 +- src/pages/home/HeaderView.tsx | 6 +++- src/pages/home/ReportScreen.tsx | 3 +- 7 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/components/ReportActionItem/TaskPreview.tsx b/src/components/ReportActionItem/TaskPreview.tsx index f6f436cbd51e..e09054baa58c 100644 --- a/src/components/ReportActionItem/TaskPreview.tsx +++ b/src/components/ReportActionItem/TaskPreview.tsx @@ -106,12 +106,12 @@ function TaskPreview({taskReportID, action, contextMenuAnchor, chatReportID, che { if (isTaskCompleted) { - Task.reopenTask(taskReport); + Task.reopenTask(taskReport, taskReportID); } else { - Task.completeTask(taskReport); + Task.completeTask(taskReport, taskReportID); } })} accessibilityLabel={translate('task.task')} diff --git a/src/components/ReportActionItem/TaskView.tsx b/src/components/ReportActionItem/TaskView.tsx index 9a2906aa7d62..480c4573f293 100644 --- a/src/components/ReportActionItem/TaskView.tsx +++ b/src/components/ReportActionItem/TaskView.tsx @@ -56,7 +56,7 @@ function TaskView({report, ...props}: TaskViewProps) { const isCompleted = ReportUtils.isCompletedTaskReport(report); const isOpen = ReportUtils.isOpenTaskReport(report); const canModifyTask = Task.canModifyTask(report, props.currentUserPersonalDetails.accountID); - const canActionTask = Task.canActionTask(report, props.currentUserPersonalDetails.accountID); + const canActionTask = Task.canModifyTask(report, props.currentUserPersonalDetails.accountID, true); const disableState = !canModifyTask; const isDisableInteractive = !canModifyTask || !isOpen; const personalDetails = usePersonalDetails() || CONST.EMPTY_OBJECT; @@ -88,8 +88,8 @@ function TaskView({report, ...props}: TaskViewProps) { styles.pv2, StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed, false, disableState, !isDisableInteractive), true), isDisableInteractive && !disableState && styles.cursorDefault, + disableState && styles.cursorDisabled, ]} - disabled={disableState} accessibilityLabel={taskTitle || translate('task.task')} > {({pressed}) => ( @@ -114,7 +114,7 @@ function TaskView({report, ...props}: TaskViewProps) { containerBorderRadius={8} caretSize={16} accessibilityLabel={taskTitle || translate('task.task')} - disabled={!canModifyTask || !canActionTask} + disabled={!canActionTask} />