feat: add disable signup feature flag (#9274)
* feat: add feature flag * feat: use the feature flag
This commit is contained in:
parent
869f459d98
commit
75c9145558
|
@ -9,10 +9,10 @@ import { z } from "zod";
|
|||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import { checkPremiumUsername } from "@calcom/features/ee/common/lib/checkPremiumUsername";
|
||||
import { isSAMLLoginEnabled } from "@calcom/features/ee/sso/lib/saml";
|
||||
import { getFeatureFlagMap } from "@calcom/features/flags/server/utils";
|
||||
import { IS_SELF_HOSTED, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
|
||||
import { Alert, Button, EmailField, HeadSeo, PasswordField, TextField } from "@calcom/ui";
|
||||
|
||||
|
@ -158,6 +158,8 @@ export default function Signup({ prepopulateFormValues, token }: inferSSRProps<t
|
|||
}
|
||||
|
||||
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||
const prisma = await import("@calcom/prisma").then((mod) => mod.default);
|
||||
const flags = await getFeatureFlagMap(prisma);
|
||||
const ssr = await ssrInit(ctx);
|
||||
const token = z.string().optional().parse(ctx.query.token);
|
||||
|
||||
|
@ -168,7 +170,9 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
|||
prepopulateFormValues: undefined,
|
||||
};
|
||||
|
||||
if (process.env.NEXT_PUBLIC_DISABLE_SIGNUP === "true") {
|
||||
if (process.env.NEXT_PUBLIC_DISABLE_SIGNUP === "true" || flags["disable-signup"]) {
|
||||
console.log({ flag: flags["disable-signup"] });
|
||||
|
||||
return {
|
||||
notFound: true,
|
||||
};
|
||||
|
|
|
@ -11,4 +11,5 @@ export type AppFlags = {
|
|||
"v2-booking-page": boolean;
|
||||
"managed-event-types": boolean;
|
||||
"google-workspace-directory": boolean;
|
||||
"disable-signup": boolean;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
INSERT INTO
|
||||
"Feature" (slug, enabled, description, "type")
|
||||
VALUES
|
||||
(
|
||||
'disable-signup',
|
||||
false,
|
||||
'Enable to prevent users from signing up',
|
||||
'OPERATIONAL'
|
||||
) ON CONFLICT (slug) DO NOTHING;
|
||||
|
Loading…
Reference in New Issue
Block a user