fix(Approval Workflows): Workflows keep approval history after deletion (#2834)

* improvement: Approval Workflows can be deleted while maintaining history
Co-authored-by: Daniel Hougaard <[email protected]>
This commit is contained in:
McPizza
2024-12-09 20:03:45 +01:00
committed by GitHub
parent c648235390
commit 97f85fa8d9
16 changed files with 203 additions and 36 deletions
@@ -130,6 +130,9 @@ export const accessApprovalRequestServiceFactory = ({
message: `No policy in environment with slug '${environment.slug}' and with secret path '${secretPath}' was found.`
});
}
if (policy.deletedAt) {
throw new BadRequestError({ message: "The policy linked to this request has been deleted" });
}
const approverIds: string[] = [];
const approverGroupIds: string[] = [];
@@ -309,6 +312,12 @@ export const accessApprovalRequestServiceFactory = ({
}
const { policy } = accessApprovalRequest;
if (policy.deletedAt) {
throw new BadRequestError({
message: "The policy associated with this access request has been deleted."
});
}
const { membership, hasRole } = await permissionService.getProjectPermission(
actor,
actorId,