From 1e2991519fada31b1ec0ebcadedbe0aa62e85a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Fri, 14 Jun 2024 12:12:24 +0200 Subject: [PATCH] (core) Restoring GRIST_DEFAULT_PRODUCT functionality Summary: The GRIST_DEFAULT_PRODUCT wasn't used for grist-ee, now it is respected. Test Plan: I've build grist-ee docker image from github and run it using our instruction (both for recreating the issue and confirming it is fixed) ``` docker run -p 8484:8484 \ -v $PWD:/persist \ -e GRIST_SESSION_SECRET=invent-a-secret-here \ -e GRIST_SINGLE_ORG=cool-beans -it gristlabs/grist-ee ``` For grist-core I recreated/confirmed it is fixed it just by `GRIST_SINGLE_ORG=team npm start` in the core folder. I also created some team sites using stubbed UI and confirmed that they were using the GRIST_DEFAULT_PRODUCT product. Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4271 --- app/client/ui/CreateTeamModal.ts | 4 +++- app/gen-server/entity/Product.ts | 5 ++--- stubs/app/server/server.ts | 2 -- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/client/ui/CreateTeamModal.ts b/app/client/ui/CreateTeamModal.ts index 4c633e98..4dccfc2e 100644 --- a/app/client/ui/CreateTeamModal.ts +++ b/app/client/ui/CreateTeamModal.ts @@ -136,7 +136,9 @@ function buildTeamPage({ } await create(); } finally { - disabled.set(false); + if (!disabled.isDisposed()) { + disabled.set(false); + } } } const clickOnEnter = dom.onKeyPress({ diff --git a/app/gen-server/entity/Product.ts b/app/gen-server/entity/Product.ts index 0ecde6da..42ce6526 100644 --- a/app/gen-server/entity/Product.ts +++ b/app/gen-server/entity/Product.ts @@ -147,12 +147,11 @@ export const PRODUCTS: IProduct[] = [ */ export function getDefaultProductNames() { const defaultProduct = process.env.GRIST_DEFAULT_PRODUCT; - const personalFreePlan = PERSONAL_FREE_PLAN; return { // Personal site start off on a functional plan. - personal: defaultProduct || personalFreePlan, + personal: defaultProduct || PERSONAL_FREE_PLAN, // Team site starts off on a limited plan, requiring subscription. - teamInitial: defaultProduct || 'stub', + teamInitial: defaultProduct || STUB_PLAN, // Team site that has been 'turned off'. teamCancel: 'suspended', // Functional team site. diff --git a/stubs/app/server/server.ts b/stubs/app/server/server.ts index cfb13172..20ab2d26 100644 --- a/stubs/app/server/server.ts +++ b/stubs/app/server/server.ts @@ -7,7 +7,6 @@ import {commonUrls} from 'app/common/gristUrls'; import {isAffirmative} from 'app/common/gutil'; import {HomeDBManager} from 'app/gen-server/lib/HomeDBManager'; -import {TEAM_FREE_PLAN} from 'app/common/Features'; const debugging = isAffirmative(process.env.DEBUG) || isAffirmative(process.env.VERBOSE); @@ -90,7 +89,6 @@ async function setupDb() { }, { setUserAsOwner: false, useNewPlan: true, - product: TEAM_FREE_PLAN })); } }