Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Fix issue where user cannot be deleted (#2032)

Luke Vella13883b2a05a9
diff --git a/apps/web/src/features/user/ability.ts b/apps/web/src/features/user/ability.ts
index 64c85c23f..81ffc95cd 100644
--- a/apps/web/src/features/user/ability.ts
+++ b/apps/web/src/features/user/ability.ts
@@ -51,9 +51,9 @@ function defineAbilityForUser(
// Cannot delete user if they have active subscriptions
cannot("delete", "User", {
- spaces: {
+ subscriptions: {
some: {
- tier: "pro",
+ active: true,
},
},
});
diff --git a/apps/web/src/features/user/actions.ts b/apps/web/src/features/user/actions.ts
index 71e6714dc..dc45fdc26 100644
--- a/apps/web/src/features/user/actions.ts
+++ b/apps/web/src/features/user/actions.ts
@@ -64,9 +64,9 @@ export const deleteUserAction = adminActionClient
const user = await prisma.user.findUnique({
where: { id: userId },
include: {
- spaces: {
+ subscriptions: {
select: {
- tier: true,
+ active: true,
},
},
},