Skip to content

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

🐛 Fix issue that prevents space from being deleted (#2025)

Luke Vella18c14843e7b8
diff --git a/apps/web/src/features/space/actions.ts b/apps/web/src/features/space/actions.ts
index 7d251ba99..ce413ae09 100644
--- a/apps/web/src/features/space/actions.ts
+++ b/apps/web/src/features/space/actions.ts
@@ -124,6 +124,14 @@ export const deleteSpaceAction = spaceActionClient
id: true,
ownerId: true,
tier: true,
+ subscriptions: {
+ where: {
+ active: true,
+ },
+ select: {
+ id: true,
+ },
+ },
},
});
@@ -137,12 +145,12 @@ export const deleteSpaceAction = spaceActionClient
if (ctx.getMemberAbility().cannot("delete", subject("Space", space))) {
throw new AppError({
code: "FORBIDDEN",
- message: "You do not have access to this space",
+ message: "You do not have permission to delete this space",
});
}
// Check if space has an active subscription
- if (space.tier === "pro") {
+ if (space.subscriptions.length > 0) {
throw new AppError({
code: "FORBIDDEN",
message: