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:
@@ -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";
|
||||
|
||||
export { getServerSideProps } from "@lib/event-types/getServerSideProps";
|
||||
|
||||
EventTypesPage.getLayout = getLayout;
|
||||
EventTypesPage.PageWrapper = PageWrapper;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
||||
import { classNames } from "@calcom/lib";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
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;
|
||||
|
||||
return (
|
||||
@@ -268,10 +266,7 @@ export default function CreateEventTypeDialog({
|
||||
onValueChange={(val: SchedulingType) => {
|
||||
form.setValue("schedulingType", val);
|
||||
}}
|
||||
className={classNames(
|
||||
"mt-1 flex gap-4",
|
||||
isAdmin && flags["managed-event-types"] && "flex-col"
|
||||
)}>
|
||||
className={classNames("mt-1 flex gap-4", isAdmin && "flex-col")}>
|
||||
<RadioArea.Item
|
||||
{...register("schedulingType")}
|
||||
value={SchedulingType.COLLECTIVE}
|
||||
@@ -289,7 +284,7 @@ export default function CreateEventTypeDialog({
|
||||
<p>{t("round_robin_description")}</p>
|
||||
</RadioArea.Item>
|
||||
<>
|
||||
{isAdmin && flags["managed-event-types"] && (
|
||||
{isAdmin && (
|
||||
<RadioArea.Item
|
||||
{...register("schedulingType")}
|
||||
value={SchedulingType.MANAGED}
|
||||
|
||||
@@ -9,7 +9,6 @@ export type AppFlags = {
|
||||
teams: boolean;
|
||||
webhooks: boolean;
|
||||
workflows: boolean;
|
||||
"managed-event-types": boolean;
|
||||
organizations: boolean;
|
||||
"email-verification": boolean;
|
||||
"google-workspace-directory": boolean;
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { AppFlags } from "@calcom/features/flags/config";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
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> {
|
||||
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