Skip to content

Commit

Permalink
Merge pull request #31674 from s-alves10/fix/issue-29049
Browse files Browse the repository at this point in the history
fix: check if the parent report is the archived room
  • Loading branch information
neil-marcellini authored Feb 20, 2024
2 parents 6b413b2 + d5eee76 commit e485645
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 5 additions & 0 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,11 @@ function canModifyTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID
return false;
}

const parentReport = ReportUtils.getParentReport(taskReport);
if (ReportUtils.isArchivedRoom(parentReport)) {
return false;
}

if (sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport)) {
return true;
}
Expand Down

0 comments on commit e485645

Please sign in to comment.