fix: initialized flags on event-types page (#13469)
* fix: initialized flags on event-types page * changes * chore: removed `managed-event-types` flag as no longer needed * revert: `20230404202721_add_feature_flag_managed_event_types` migration
This commit is contained in:
1 parent
0421dd401a
commit
a45d77de51
6 files changed
+31
-9
No files matched your search
@@ -0,0 +1,23 @@
|
|||||||
|
import type { GetServerSidePropsContext } from "next";
|
||||||
|
|
||||||
|
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||||
|
|
||||||
|
import { ssrInit } from "@server/lib/ssr";
|
||||||
|
|
||||||
|
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
|
||||||
|
const ssr = await ssrInit(context);
|
||||||
|
const session = await getServerSession({ req: context.req, res: context.res });
|
||||||
|
|
||||||
|
if (!session) {
|
||||||
|
return {
|
||||||
|
redirect: {
|
||||||
|
redirect: {
|
||||||
|
permanent: false,
|
||||||
|
destination: "/auth/login",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return { props: { trpcState: ssr.dehydrate() } };
|
||||||
|
};
|
||||||
@@ -4,6 +4,8 @@ import PageWrapper from "@components/PageWrapper";
|
|||||||
|
|
||||||
import EventTypesPage from "~/event-types/views/event-types-listing-view";
|
import EventTypesPage from "~/event-types/views/event-types-listing-view";
|
||||||
|
|
||||||
|
export { getServerSideProps } from "@lib/event-types/getServerSideProps";
|
||||||
|
|
||||||
EventTypesPage.getLayout = getLayout;
|
EventTypesPage.getLayout = getLayout;
|
||||||
EventTypesPage.PageWrapper = PageWrapper;
|
EventTypesPage.PageWrapper = PageWrapper;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { useForm } from "react-hook-form";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
|
||||||
import { classNames } from "@calcom/lib";
|
import { classNames } from "@calcom/lib";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery";
|
import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery";
|
||||||
@@ -145,7 +144,6 @@ export default function CreateEventTypeDialog({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const flags = useFlagMap();
|
|
||||||
const urlPrefix = orgBranding?.fullDomain ?? process.env.NEXT_PUBLIC_WEBSITE_URL;
|
const urlPrefix = orgBranding?.fullDomain ?? process.env.NEXT_PUBLIC_WEBSITE_URL;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -268,10 +266,7 @@ export default function CreateEventTypeDialog({
|
|||||||
onValueChange={(val: SchedulingType) => {
|
onValueChange={(val: SchedulingType) => {
|
||||||
form.setValue("schedulingType", val);
|
form.setValue("schedulingType", val);
|
||||||
}}
|
}}
|
||||||
className={classNames(
|
className={classNames("mt-1 flex gap-4", isAdmin && "flex-col")}>
|
||||||
"mt-1 flex gap-4",
|
|
||||||
isAdmin && flags["managed-event-types"] && "flex-col"
|
|
||||||
)}>
|
|
||||||
<RadioArea.Item
|
<RadioArea.Item
|
||||||
{...register("schedulingType")}
|
{...register("schedulingType")}
|
||||||
value={SchedulingType.COLLECTIVE}
|
value={SchedulingType.COLLECTIVE}
|
||||||
@@ -289,7 +284,7 @@ export default function CreateEventTypeDialog({
|
|||||||
<p>{t("round_robin_description")}</p>
|
<p>{t("round_robin_description")}</p>
|
||||||
</RadioArea.Item>
|
</RadioArea.Item>
|
||||||
<>
|
<>
|
||||||
{isAdmin && flags["managed-event-types"] && (
|
{isAdmin && (
|
||||||
<RadioArea.Item
|
<RadioArea.Item
|
||||||
{...register("schedulingType")}
|
{...register("schedulingType")}
|
||||||
value={SchedulingType.MANAGED}
|
value={SchedulingType.MANAGED}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export type AppFlags = {
|
|||||||
teams: boolean;
|
teams: boolean;
|
||||||
webhooks: boolean;
|
webhooks: boolean;
|
||||||
workflows: boolean;
|
workflows: boolean;
|
||||||
"managed-event-types": boolean;
|
|
||||||
organizations: boolean;
|
organizations: boolean;
|
||||||
"email-verification": boolean;
|
"email-verification": boolean;
|
||||||
"google-workspace-directory": boolean;
|
"google-workspace-directory": boolean;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { AppFlags } from "@calcom/features/flags/config";
|
|||||||
import { trpc } from "@calcom/trpc/react";
|
import { trpc } from "@calcom/trpc/react";
|
||||||
|
|
||||||
const initialData: Partial<AppFlags> = process.env.NEXT_PUBLIC_IS_E2E
|
const initialData: Partial<AppFlags> = process.env.NEXT_PUBLIC_IS_E2E
|
||||||
? { "managed-event-types": true, organizations: true, teams: true }
|
? { organizations: true, teams: true }
|
||||||
: {};
|
: {};
|
||||||
export function useFlags(): Partial<AppFlags> {
|
export function useFlags(): Partial<AppFlags> {
|
||||||
const query = trpc.viewer.features.map.useQuery(undefined, {
|
const query = trpc.viewer.features.map.useQuery(undefined, {
|
||||||
|
|||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
-- revert 20230404202721_add_feature_flag_managed_event_types
|
||||||
|
|
||||||
|
DELETE FROM "Feature" WHERE slug = 'managed-event-types';
|
||||||
Reference in new issue
Block a user