diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsx index 7b911fbe19..632ba29b22 100644 --- a/apps/web/components/eventtype/EventSetupTab.tsx +++ b/apps/web/components/eventtype/EventSetupTab.tsx @@ -46,11 +46,14 @@ const getDefaultLocationValue = (options: EventTypeSetupProps["locationOptions"] }; export const EventSetupTab = ( - props: Pick + props: Pick< + EventTypeSetupProps, + "eventType" | "locationOptions" | "team" | "teamMembers" | "destinationCalendar" + > ) => { const { t } = useLocale(); const formMethods = useFormContext(); - const { eventType, locationOptions, team } = props; + const { eventType, locationOptions, team, destinationCalendar } = props; const [showLocationModal, setShowLocationModal] = useState(false); const [editingLocationType, setEditingLocationType] = useState(""); const [selectedLocation, setSelectedLocation] = useState(undefined); @@ -231,7 +234,10 @@ export const EventSetupTab = ( ); })} - {validLocations.some((location) => location.type === MeetLocationType) && ( + {validLocations.some( + (location) => + location.type === MeetLocationType && destinationCalendar?.integration !== "google_calendar" + ) && (
@@ -243,7 +249,6 @@ export const EventSetupTab = ( className="underline"> here. {" "} - We will fall back to Cal video if you do not change it.

diff --git a/apps/web/pages/event-types/[type]/index.tsx b/apps/web/pages/event-types/[type]/index.tsx index f54f839202..0c9e185f6e 100644 --- a/apps/web/pages/event-types/[type]/index.tsx +++ b/apps/web/pages/event-types/[type]/index.tsx @@ -123,7 +123,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { extendsFeature: "EventType", }); - const { eventType, locationOptions, team, teamMembers, currentUserMembership } = props; + const { eventType, locationOptions, team, teamMembers, currentUserMembership, destinationCalendar } = props; const [animationParentRef] = useAutoAnimate(); const updateMutation = trpc.viewer.eventTypes.update.useMutation({ @@ -261,6 +261,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { locationOptions={locationOptions} team={team} teamMembers={teamMembers} + destinationCalendar={destinationCalendar} /> ), availability: , diff --git a/packages/lib/getEventTypeById.ts b/packages/lib/getEventTypeById.ts index ff0d212655..bcf4c192ab 100644 --- a/packages/lib/getEventTypeById.ts +++ b/packages/lib/getEventTypeById.ts @@ -282,9 +282,20 @@ export default async function getEventTypeById({ // Sets to null if no membership is found - this must mean we are in a none team event type const currentUserMembership = eventTypeObject.team?.members.find((el) => el.user.id === userId) ?? null; + let destinationCalendar = eventTypeObject.destinationCalendar; + if (!destinationCalendar) { + destinationCalendar = await prisma.destinationCalendar.findFirst({ + where: { + userId: userId, + eventTypeId: null, + }, + }); + } + const finalObj = { eventType: eventTypeObject, locationOptions, + destinationCalendar, team: eventTypeObject.team || null, teamMembers, currentUserMembership,