Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Throw an error when they try to change a default workspace folder's permission to no access

Kiran Ka2cc7f244bd2
diff --git a/apps/web/app/api/folders/[folderId]/route.ts b/apps/web/app/api/folders/[folderId]/route.ts
index db3aebc462..0b817418a3 100644
--- a/apps/web/app/api/folders/[folderId]/route.ts
+++ b/apps/web/app/api/folders/[folderId]/route.ts
@@ -68,6 +68,14 @@ export const PATCH = withWorkspace(
requiredPermission: "folders.write",
});
+ if (workspace.defaultFolderId === folderId && accessLevel === null) {
+ throw new DubApiError({
+ code: "conflict",
+ message:
+ "This is the workspace's default folder and cannot be set to no access.",
+ });
+ }
+
try {
const updatedFolder = await prisma.folder.update({
where: {