From 18d46518d7626e8f0966bc51c408aaa6392fbe09 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Wed, 22 Nov 2023 00:55:01 -0600 Subject: [PATCH 1/3] fix: check if the parent report is the archived room --- src/libs/actions/Task.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index c91f6d1a2eec..e59debd08a1d 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -877,6 +877,11 @@ function canModifyTask(taskReport, sessionAccountID) { return false; } + const parentReport = ReportUtils.getParentReport(taskReport); + if (ReportUtils.isArchivedRoom(parentReport)) { + return false; + } + if (sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport)) { return true; } @@ -884,7 +889,6 @@ function canModifyTask(taskReport, sessionAccountID) { // If you don't have access to the task report (maybe haven't opened it yet), check if you can access the parent report // - If the parent report is an #admins only room // - If you are a policy admin - const parentReport = ReportUtils.getParentReport(taskReport); return ReportUtils.isAllowedToComment(parentReport); } From 958bb7027f075cf71c6241434b9ced2cc6b8dc75 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Wed, 20 Dec 2023 04:54:23 -0600 Subject: [PATCH 2/3] fix: remove redundant code --- src/libs/actions/Task.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 03b94d5f82de..50172158efdb 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -882,8 +882,6 @@ function canModifyTask(taskReport, sessionAccountID, policyRole = '') { return true; } - const parentReport = ReportUtils.getParentReport(taskReport); - if (policyRole && (ReportUtils.isChatRoom(parentReport) || ReportUtils.isPolicyExpenseChat(parentReport)) && policyRole !== CONST.POLICY.ROLE.ADMIN) { return false; } From 7df878420d4f01d8b61cd3ac026d8afeff5b7315 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Tue, 20 Feb 2024 04:14:23 -0600 Subject: [PATCH 3/3] fix: archive child task report optimistically when deleting workspace --- src/libs/actions/Policy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 9e6745bbc291..4e4d4de09b72 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -262,7 +262,9 @@ function deleteWorkspace(policyID: string, policyName: string) { : []), ]; - const reportsToArchive = Object.values(allReports ?? {}).filter((report) => report?.policyID === policyID && (ReportUtils.isChatRoom(report) || ReportUtils.isPolicyExpenseChat(report))); + const reportsToArchive = Object.values(allReports ?? {}).filter( + (report) => report?.policyID === policyID && (ReportUtils.isChatRoom(report) || ReportUtils.isPolicyExpenseChat(report) || ReportUtils.isTaskReport(report)), + ); reportsToArchive.forEach((report) => { const {reportID, ownerAccountID} = report ?? {}; optimisticData.push({