Add flock exports, sharing invitations, and improved flock switching
Deploy / deploy-prod (push) Skipped
Deploy / deploy-dev (push) Successful in 3m53s

This commit is contained in:
Corey Blais committed 2026-10-08 11:19:50 -04:00
1 parent ff177dbaed
commit 55353e4d46
12 files changed
+557 -100

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import type { WorkspaceRow, WorkspaceType } from './types.js';
type WorkspaceAccess = Pick<WorkspaceRow, 'name' | 'workspace_type' | 'subscription_status' | 'rescue_verification_status'>;
export const subscriptionAllowsWrite = (workspace: WorkspaceAccess) => {
if (workspace.workspace_type === 'rescue') {
return workspace.rescue_verification_status === 'approved';
}
return workspace.subscription_status === 'active' || workspace.subscription_status === 'trialing';
};
export const canUpdateWorkspaceSettings = (
workspace: WorkspaceAccess,
payload: { name: string; workspaceType: WorkspaceType },
isAdmin: boolean,
) => {
// Requesting rescue verification must not require buying a household subscription.
// The route still validates onboarding and the repository marks the rescue pending.
const requestingRescue = workspace.workspace_type === 'standard' && payload.workspaceType === 'rescue';
const billingOnly = workspace.workspace_type === 'standard' && payload.workspaceType === 'standard' && payload.name === workspace.name;
return isAdmin || subscriptionAllowsWrite(workspace) || requestingRescue || billingOnly;
};