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.

fix folder flags on API routes

Steven Tey8ff6f20680c2
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/route.ts
index 38e36913f2..22230a0a40 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/route.ts
@@ -46,6 +46,7 @@ export const GET = withWorkspace(
...workspace,
id: `ws_${workspace.id}`,
domains,
+ // TODO: Remove this once Folders goes GA
flags: {
...flags,
linkFolders: flags.linkFolders || workspace.partnersEnabled,
diff --git a/apps/web/lib/auth/workspace.ts b/apps/web/lib/auth/workspace.ts
index 8eab07126c..bf95d94530 100644
--- a/apps/web/lib/auth/workspace.ts
+++ b/apps/web/lib/auth/workspace.ts
@@ -341,10 +341,16 @@ export const withWorkspace = (
// beta feature checks
if (featureFlag) {
- const flags = await getFeatureFlags({
+ let flags = await getFeatureFlags({
workspaceId: workspace.id,
});
+ // TODO: Remove this once Folders goes GA
+ flags = {
+ ...flags,
+ linkFolders: flags.linkFolders || workspace.partnersEnabled,
+ };
+
if (!flags[featureFlag]) {
throw new DubApiError({
code: "forbidden",