Merge branch 'main' into v2/teams-billing

This commit is contained in:
Peer Richelsen 2022-10-26 14:45:55 +01:00 committed by GitHub
commit 0372e3eb26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 25 deletions

View File

@ -2,7 +2,6 @@ import DailyIframe from "@daily-co/daily-js";
import { NextPageContext } from "next"; import { NextPageContext } from "next";
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
import Head from "next/head"; import Head from "next/head";
import Link from "next/link";
import { useEffect } from "react"; import { useEffect } from "react";
import { SEO_IMG_OGIMG_VIDEO, WEBSITE_URL } from "@calcom/lib/constants"; import { SEO_IMG_OGIMG_VIDEO, WEBSITE_URL } from "@calcom/lib/constants";
@ -64,20 +63,15 @@ export default function JoinCall(props: JoinCallPageProps) {
<meta property="twitter:description" content={t("quick_video_meeting")} /> <meta property="twitter:description" content={t("quick_video_meeting")} />
</Head> </Head>
<div style={{ zIndex: 2, position: "relative" }}> <div style={{ zIndex: 2, position: "relative" }}>
<Link href="/" passHref> <img
{ className="h-5·w-auto fixed z-10 hidden sm:inline-block"
// eslint-disable-next-line @next/next/no-img-element src={`${WEBSITE_URL}/cal-logo-word-dark.svg`}
<img alt="Cal.com Logo"
className="h-5·w-auto fixed z-10 hidden sm:inline-block" style={{
src={`${WEBSITE_URL}/cal-logo-word-dark.svg`} top: 46,
alt="Cal.com Logo" left: 24,
style={{ }}
top: 46, />
left: 24,
}}
/>
}
</Link>
</div> </div>
</> </>
); );

View File

@ -187,23 +187,49 @@ export default abstract class BaseCalendarService implements Calendar {
additionalInfo: {}, additionalInfo: {},
}; };
} }
let calendarEvent: CalendarEventType;
const eventsToUpdate = events.filter((e) => e.uid === uid); const eventsToUpdate = events.filter((e) => e.uid === uid);
return Promise.all( return Promise.all(
eventsToUpdate.map((e) => { eventsToUpdate.map((eventItem) => {
calendarEvent = eventItem;
return updateCalendarObject({ return updateCalendarObject({
calendarObject: { calendarObject: {
url: e.url, url: calendarEvent.url,
data: iCalString, // ensures compliance with standard iCal string (known as iCal2.0 by some) required by various providers
etag: e?.etag, data: iCalString?.replace(/METHOD:[^\r\n]+\r\n/g, ""),
etag: calendarEvent?.etag,
}, },
headers: this.headers, 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) { } catch (reason) {
this.log.error(reason); this.log.error(reason);
throw reason; throw reason;
} }
} }
@ -213,7 +239,6 @@ export default abstract class BaseCalendarService implements Calendar {
const events = await this.getEventsByUID(uid); const events = await this.getEventsByUID(uid);
const eventsToDelete = events.filter((event) => event.uid === uid); const eventsToDelete = events.filter((event) => event.uid === uid);
await Promise.all( await Promise.all(
eventsToDelete.map((event) => { eventsToDelete.map((event) => {
return deleteCalendarObject({ return deleteCalendarObject({
@ -275,7 +300,7 @@ export default abstract class BaseCalendarService implements Calendar {
const events: { start: string; end: string }[] = []; const events: { start: string; end: string }[] = [];
objects.forEach((object) => { objects.forEach((object) => {
if (object.data == null) return; if (object.data == null || JSON.stringify(object.data) == "{}") return;
const jcalData = ICAL.parse(sanitizeCalendarObject(object)); const jcalData = ICAL.parse(sanitizeCalendarObject(object));
const vcalendar = new ICAL.Component(jcalData); const vcalendar = new ICAL.Component(jcalData);
@ -330,7 +355,7 @@ export default abstract class BaseCalendarService implements Calendar {
} catch (error) { } catch (error) {
if (error instanceof Error && error.message !== currentError) { if (error instanceof Error && error.message !== currentError) {
currentError = error.message; currentError = error.message;
console.log("error", error); this.log.error("error", error);
} }
} }
if (!currentEvent) return; if (!currentEvent) return;