From 51c89d72e39c72744c3a1f25e7556e6e5d1b689d Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 14 Mar 2024 11:15:04 +0700 Subject: [PATCH 1/2] fix anonymous user can delete task --- src/pages/home/HeaderView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index 8e0aefc39257..172fae5994ba 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -135,7 +135,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction, threeDotMenuItems.push({ icon: Expensicons.Trashcan, text: translate('common.delete'), - onSelected: () => setIsDeleteTaskConfirmModalVisible(true), + onSelected: Session.checkIfActionIsAllowed(() => setIsDeleteTaskConfirmModalVisible(true)), }); } } @@ -349,7 +349,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction, isVisible={isDeleteTaskConfirmModalVisible} onConfirm={() => { setIsDeleteTaskConfirmModalVisible(false); - Session.checkIfActionIsAllowed(Task.deleteTask(report)); + Task.deleteTask(report) }} onCancel={() => setIsDeleteTaskConfirmModalVisible(false)} title={translate('task.deleteTask')} From ce945a61783fe6dc1dbedbb28513b04662d83a30 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 22 Mar 2024 01:07:20 +0700 Subject: [PATCH 2/2] fix lint --- src/pages/home/HeaderView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx index 172fae5994ba..43544ec237d6 100644 --- a/src/pages/home/HeaderView.tsx +++ b/src/pages/home/HeaderView.tsx @@ -349,7 +349,7 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction, isVisible={isDeleteTaskConfirmModalVisible} onConfirm={() => { setIsDeleteTaskConfirmModalVisible(false); - Task.deleteTask(report) + Task.deleteTask(report); }} onCancel={() => setIsDeleteTaskConfirmModalVisible(false)} title={translate('task.deleteTask')}