Skip to content

Scheduling infrastructure for absolutely everyone.

Only show Google Meet dependency when GCal is not set as destination calendar (#7442)

Joe Au-Yeung5f9f6ef0250c
diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsx
index 7b911fbe193..632ba29b225 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<EventTypeSetupProps, "eventType" | "locationOptions" | "team" | "teamMembers">
+ props: Pick<
+ EventTypeSetupProps,
+ "eventType" | "locationOptions" | "team" | "teamMembers" | "destinationCalendar"
+ >
) => {
const { t } = useLocale();
const formMethods = useFormContext<FormValues>();
- const { eventType, locationOptions, team } = props;
+ const { eventType, locationOptions, team, destinationCalendar } = props;
const [showLocationModal, setShowLocationModal] = useState(false);
const [editingLocationType, setEditingLocationType] = useState<string>("");
const [selectedLocation, setSelectedLocation] = useState<LocationOption | undefined>(undefined);
@@ -231,7 +234,10 @@ export const EventSetupTab = (
</li>
);
})}
- {validLocations.some((location) => location.type === MeetLocationType) && (
+ {validLocations.some(
+ (location) =>
+ location.type === MeetLocationType && destinationCalendar?.integration !== "google_calendar"
+ ) && (
<div className="flex text-sm text-gray-600">
<FiCheck className="mt-0.5 mr-1.5 h-2 w-2.5" />
<Trans i18nKey="event_type_requres_google_cal">
@@ -243,7 +249,6 @@ export const EventSetupTab = (
className="underline">
here.
</Link>{" "}
- We will fall back to Cal video if you do not change it.
</p>
</Trans>
</div>
diff --git a/apps/web/pages/event-types/[type]/index.tsx b/apps/web/pages/event-types/[type]/index.tsx
index f54f839202a..0c9e185f6e0 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<HTMLDivElement>();
const updateMutation = trpc.viewer.eventTypes.update.useMutation({
@@ -261,6 +261,7 @@ const EventTypePage = (props: EventTypeSetupProps) => {
locationOptions={locationOptions}
team={team}
teamMembers={teamMembers}
+ destinationCalendar={destinationCalendar}
/>
),
availability: <AvailabilityTab isTeamEvent={!!team} />,
diff --git a/packages/lib/getEventTypeById.ts b/packages/lib/getEventTypeById.ts
index ff0d2126550..bcf4c192ab7 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,