This commit is contained in:
Leo Giovanetti 2023-06-13 11:55:19 -03:00
parent cdf60dacfb
commit 65cdd2e8e7
8 changed files with 15 additions and 17 deletions

View File

@ -46,10 +46,7 @@ const BookingDescription: FC<Props> = (props) => {
const { profile, eventType, isBookingPage = false, children } = props;
const { date: bookingDate } = useRouterQuery("date");
const { t } = useLocale();
const { duration, setQuery: setDuration } = useRouterQuery("duration", {
// Only set duration query parameter when event type has multiple durations
disabled: !eventType.metadata?.multipleDuration,
});
const { duration, setQuery: setDuration } = useRouterQuery("duration");
useEffect(() => {
if (

View File

@ -1,6 +1,6 @@
import { useRouter } from "next/router";
export default function useRouterQuery<T extends string>(name: T, config?: { disabled: boolean }) {
export default function useRouterQuery<T extends string>(name: T) {
const router = useRouter();
const existingQueryParams = router.asPath.split("?")[1];
@ -26,12 +26,10 @@ export default function useRouterQuery<T extends string>(name: T, config?: { dis
}
const setQuery = (newValue: string | number | null | undefined) => {
// Only set query param if it is not disabled
if (!config?.disabled) {
router.replace({ pathname: router.asPath, query: { ...query, [name]: newValue } }, undefined, {
shallow: true,
});
}
router.replace({ query: { ...router.query, [name]: newValue } }, undefined, {
shallow: true,
});
router.replace({ query: { ...router.query, ...query, [name]: newValue } }, undefined, { shallow: true });
};
return { [name]: query[name], setQuery } as {

View File

@ -256,7 +256,7 @@ const getEventTypesWithHiddenFromDB = async (userId: number) => {
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const ssr = await ssrInit(context);
const crypto = await import("crypto");
const { isValidOrgDomain } = orgDomainConfig(context.req.headers.host ?? "");
const { currentOrgDomain, isValidOrgDomain } = orgDomainConfig(context.req.headers.host ?? "");
const usernameList = getUsernameList(context.query.user as string);
const dataFetchStart = Date.now();
@ -265,6 +265,11 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
username: {
in: usernameList,
},
organization: isValidOrgDomain
? {
slug: currentOrgDomain,
}
: null,
},
select: {
id: true,

View File

@ -44,7 +44,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
}
try {
const maybeUser = await prisma.user.findFirst({
const maybeUser = await prisma.user.findUnique({
where: {
email: email.data,
},

View File

@ -26,7 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
return res.status(400).json({ message: "Couldn't find an account for this email" });
}
const maybeUser = await prisma.user.findFirst({
const maybeUser = await prisma.user.findUnique({
where: {
email: maybeRequest.email,
},

View File

@ -372,7 +372,7 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
{types.map((type, index) => {
const embedLink = `${group.profile.slug}/${type.slug}`;
const calLink = `${
orgBranding ? `${orgBranding.slug}.${subdomainSuffix()}` : CAL_URL
orgBranding ? `${new URL(CAL_URL).protocol}//${orgBranding.slug}.${subdomainSuffix()}` : CAL_URL
}/${embedLink}`;
const isManagedEventType = type.schedulingType === SchedulingType.MANAGED;
const isChildrenManagedEventType =

View File

@ -6,7 +6,6 @@ import { Controller, useForm } from "react-hook-form";
import { z } from "zod";
import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";
import { useOrgBrandingValues } from "@calcom/features/ee/organizations/hooks";
import { getLayout } from "@calcom/features/settings/layouts/SettingsLayout";
import { FULL_NAME_LENGTH_MAX_LIMIT } from "@calcom/lib/constants";
import { APP_NAME } from "@calcom/lib/constants";
@ -81,7 +80,6 @@ const ProfileView = () => {
const utils = trpc.useContext();
const { data: user, isLoading } = trpc.viewer.me.useQuery();
const { data: avatar, isLoading: isLoadingAvatar } = trpc.viewer.avatar.useQuery();
const orgBranding = useOrgBrandingValues();
const mutation = trpc.viewer.updateProfile.useMutation({
onSuccess: () => {
showToast(t("settings_updated_successfully"), "success");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB