From c437f15868c2f778352b47b0f8da74e2bf87354b Mon Sep 17 00:00:00 2001 From: Krunal Shah Date: Thu, 3 Mar 2022 15:24:19 +0530 Subject: [PATCH] fix: jitsi email does not contain meeting link (#2004) --- apps/web/components/booking/pages/BookingPage.tsx | 3 --- apps/web/lib/events/EventManager.ts | 10 +++++++++- .../web/lib/integrations/Jitsi/JitsiVideoApiAdapter.ts | 9 +++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx index 9c6ff947..49ccb7e4 100644 --- a/apps/web/components/booking/pages/BookingPage.tsx +++ b/apps/web/components/booking/pages/BookingPage.tsx @@ -85,9 +85,6 @@ const BookingPage = (props: BookingPageProps) => { if (!location) { return; } - if (location === "integrations:jitsi") { - return "https://meet.jit.si/cal/" + uuidv4(); - } if (location.includes("integration")) { return t("web_conferencing_details_to_follow"); } diff --git a/apps/web/lib/events/EventManager.ts b/apps/web/lib/events/EventManager.ts index e318b217..0f27e35d 100644 --- a/apps/web/lib/events/EventManager.ts +++ b/apps/web/lib/events/EventManager.ts @@ -5,6 +5,7 @@ import { v5 as uuidv5 } from "uuid"; import { FAKE_DAILY_CREDENTIAL } from "@lib/integrations/Daily/DailyVideoApiAdapter"; import { FAKE_HUDDLE_CREDENTIAL } from "@lib/integrations/Huddle01/Huddle01VideoApiAdapter"; +import { FAKE_JITSI_CREDENTIAL } from "@lib/integrations/Jitsi/JitsiVideoApiAdapter"; import { createEvent, updateEvent } from "@lib/integrations/calendar/CalendarManager"; import { AdditionInformation, CalendarEvent } from "@lib/integrations/calendar/interfaces/Calendar"; import { LocationType } from "@lib/location"; @@ -57,8 +58,14 @@ export const isTandem = (location: string): boolean => { return location === "integrations:tandem"; }; +export const isJitsi = (location: string): boolean => { + return location === "integrations:jitsi"; +}; + export const isDedicatedIntegration = (location: string): boolean => { - return isZoom(location) || isDaily(location) || isHuddle01(location) || isTandem(location); + return ( + isZoom(location) || isDaily(location) || isHuddle01(location) || isTandem(location) || isJitsi(location) + ); }; export const getLocationRequestFromIntegration = (location: string) => { @@ -121,6 +128,7 @@ export default class EventManager { this.videoCredentials.push(FAKE_DAILY_CREDENTIAL); } this.videoCredentials.push(FAKE_HUDDLE_CREDENTIAL); + this.videoCredentials.push(FAKE_JITSI_CREDENTIAL); } /** diff --git a/apps/web/lib/integrations/Jitsi/JitsiVideoApiAdapter.ts b/apps/web/lib/integrations/Jitsi/JitsiVideoApiAdapter.ts index 92f7c2f9..f27b4af4 100644 --- a/apps/web/lib/integrations/Jitsi/JitsiVideoApiAdapter.ts +++ b/apps/web/lib/integrations/Jitsi/JitsiVideoApiAdapter.ts @@ -1,8 +1,17 @@ +import { Credential } from "@prisma/client"; import { v4 as uuidv4 } from "uuid"; import { PartialReference } from "@lib/events/EventManager"; +import { randomString } from "@lib/random"; import { VideoApiAdapter, VideoCallData } from "@lib/videoClient"; +export const FAKE_JITSI_CREDENTIAL: Credential = { + id: +new Date().getTime(), + type: "jitsi_video", + key: { apikey: randomString(12) }, + userId: +new Date().getTime(), +}; + const JitsiVideoApiAdapter = (): VideoApiAdapter => { return { getAvailability: () => {