From f2cdb75f918174ef7a825967c3bb21b5bc6cc046 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Date: Wed, 26 Oct 2022 16:34:36 +0530 Subject: [PATCH 1/2] Hotfix/caldav reschedule jsonerror (#5193) * fixed reschedule icalstring and json error * logging update * code quality changes * removed unnecessary comment * removes console log remnants * fix for checktype * Take care of all OK status response codes Co-authored-by: Alex van Andel * Add relevant comment in code Co-authored-by: Alex van Andel Co-authored-by: Alex van Andel --- packages/lib/CalendarService.ts | 45 +++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/packages/lib/CalendarService.ts b/packages/lib/CalendarService.ts index 25b16f37b7..7a36bfc111 100644 --- a/packages/lib/CalendarService.ts +++ b/packages/lib/CalendarService.ts @@ -187,23 +187,49 @@ export default abstract class BaseCalendarService implements Calendar { additionalInfo: {}, }; } - + let calendarEvent: CalendarEventType; const eventsToUpdate = events.filter((e) => e.uid === uid); return Promise.all( - eventsToUpdate.map((e) => { + eventsToUpdate.map((eventItem) => { + calendarEvent = eventItem; return updateCalendarObject({ calendarObject: { - url: e.url, - data: iCalString, - etag: e?.etag, + url: calendarEvent.url, + // ensures compliance with standard iCal string (known as iCal2.0 by some) required by various providers + data: iCalString?.replace(/METHOD:[^\r\n]+\r\n/g, ""), + etag: calendarEvent?.etag, }, headers: this.headers, }); }) - ).then((p) => p.map((r) => r.json() as unknown as NewCalendarEventType)); + ).then((responses) => + responses.map((response) => { + if (response.status >= 200 && response.status < 300) { + return { + uid, + type: this.credentials.type, + id: typeof calendarEvent.uid === "string" ? calendarEvent.uid : "-1", + password: "", + url: calendarEvent.url, + additionalInfo: + typeof event.additionalInformation === "string" ? event.additionalInformation : {}, + }; + } else { + this.log.error("Error: Status Code", response.status); + return { + uid, + type: event.type, + id: typeof event.uid === "string" ? event.uid : "-1", + password: "", + url: typeof event.location === "string" ? event.location : "-1", + additionalInfo: + typeof event.additionalInformation === "string" ? event.additionalInformation : {}, + }; + } + }) + ); } catch (reason) { this.log.error(reason); - throw reason; } } @@ -213,7 +239,6 @@ export default abstract class BaseCalendarService implements Calendar { const events = await this.getEventsByUID(uid); const eventsToDelete = events.filter((event) => event.uid === uid); - await Promise.all( eventsToDelete.map((event) => { return deleteCalendarObject({ @@ -275,7 +300,7 @@ export default abstract class BaseCalendarService implements Calendar { const events: { start: string; end: string }[] = []; objects.forEach((object) => { - if (object.data == null) return; + if (object.data == null || JSON.stringify(object.data) == "{}") return; const jcalData = ICAL.parse(sanitizeCalendarObject(object)); const vcalendar = new ICAL.Component(jcalData); @@ -330,7 +355,7 @@ export default abstract class BaseCalendarService implements Calendar { } catch (error) { if (error instanceof Error && error.message !== currentError) { currentError = error.message; - console.log("error", error); + this.log.error("error", error); } } if (!currentEvent) return; From 5a0e4c8726f09430443f6b7882fbe7e92bb12aec Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Wed, 26 Oct 2022 14:31:19 +0100 Subject: [PATCH 2/2] removed link from cal video (#5228) * removed link from cal video * nit --- apps/web/pages/video/[uid].tsx | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/apps/web/pages/video/[uid].tsx b/apps/web/pages/video/[uid].tsx index a3655f933f..ea81652b21 100644 --- a/apps/web/pages/video/[uid].tsx +++ b/apps/web/pages/video/[uid].tsx @@ -2,7 +2,6 @@ import DailyIframe from "@daily-co/daily-js"; import { NextPageContext } from "next"; import { getSession } from "next-auth/react"; import Head from "next/head"; -import Link from "next/link"; import { useEffect } from "react"; import { SEO_IMG_OGIMG_VIDEO, WEBSITE_URL } from "@calcom/lib/constants"; @@ -64,20 +63,15 @@ export default function JoinCall(props: JoinCallPageProps) {
- - { - // eslint-disable-next-line @next/next/no-img-element - Cal.com Logo - } - + Cal.com Logo
);