Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/fix-managed-cloud-org-activation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: fix
---

Select plan flow when creating an org. Don't require GitHub verification to access the free plan.
2 changes: 1 addition & 1 deletion apps/webapp/app/models/admin.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export async function adminGetOrganizations(userId: string, { page, search }: Se
slug: true,
title: true,
v2Enabled: true,
v3Enabled: true,
isActivated: true,
deletedAt: true,
members: {
select: {
Expand Down
7 changes: 5 additions & 2 deletions apps/webapp/app/models/organization.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function createOrganization(
);
}

const _features = featuresForUrl(new URL(env.APP_ORIGIN));
const features = featuresForUrl(new URL(env.APP_ORIGIN));

const organization = await prisma.organization.create({
data: {
Expand All @@ -102,7 +102,10 @@ export async function createOrganization(
role: "ADMIN",
},
},
v3Enabled: true,
// Managed-cloud orgs start deactivated so they're routed through
// select-plan, which provisions their billing entitlement and activates
// them. Self-hosters have no billing gate, so they're active immediately.
isActivated: !features.isManagedCloud,
},
include: {
members: true,
Expand Down
4 changes: 2 additions & 2 deletions apps/webapp/app/models/project.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function createProject(
select: {
id: true,
slug: true,
v3Enabled: true,
isActivated: true,
maximumConcurrencyLimit: true,
maximumProjectCount: true,
},
Expand All @@ -49,7 +49,7 @@ export async function createProject(
}

if (version === "v3") {
if (!organization.v3Enabled) {
if (!organization.isActivated) {
throw new Error(`Organization can't create v3 projects.`);
}
}
Expand Down

This file was deleted.

Comment thread
matt-aitken marked this conversation as resolved.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
select: {
id: true,
title: true,
v3Enabled: true,
isActivated: true,
v2Enabled: true,
hasRequestedV3: true,
_count: {
Expand All @@ -138,7 +138,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
}

const { isManagedCloud } = featuresForRequest(request);
if (isManagedCloud && !organization.v3Enabled) {
if (isManagedCloud && !organization.isActivated) {
return redirect(selectPlanPath({ slug: organizationSlug }));
}

Expand All @@ -151,7 +151,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
title: organization.title,
slug: organizationSlug,
projectsCount: organization._count.projects,
v3Enabled: organization.v3Enabled,
isActivated: organization.isActivated,
v2Enabled: organization.v2Enabled,
hasRequestedV3: organization.hasRequestedV3,
},
Expand Down Expand Up @@ -324,7 +324,7 @@ export default function Page() {
const { organization, message } = useTypedLoaderData<typeof loader>();
const lastSubmission = useActionData();

const canCreateV3Projects = organization.v3Enabled;
const canCreateV3Projects = organization.isActivated;

const [form, { projectName, projectVersion }] = useForm({
id: "create-project",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const loader = dashboardLoader(
throw new Response(null, { status: 404, statusText: "Organization not found" });
}

if (organization.v3Enabled) {
if (organization.isActivated) {
return redirect(organizationPath({ slug: organizationSlug }));
}

Expand Down Expand Up @@ -73,7 +73,6 @@ export default function ChoosePlanPage() {
subscription={v3Subscription}
organizationSlug={organizationSlug}
hasPromotedPlan
showGithubVerificationBadge
periodEnd={periodEnd}
/>
</div>
Expand Down
Loading