From 5e013d5864a459088b79cae6595ca7a8e3f7ac6d Mon Sep 17 00:00:00 2001 From: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Date: Fri, 12 Aug 2022 16:46:40 -0400 Subject: [PATCH] Fixes issues with video location links from apps (#3760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix issue with video apps link not saved as location * use link as location for ping.gg * fix around link in availability page + allow breaking line for locations * use find instead of filter to get the first item Co-authored-by: Omar López Co-authored-by: CarinaWolli Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Omar López --- apps/web/components/booking/BookingListItem.tsx | 6 +++++- apps/web/components/booking/pages/AvailabilityPage.tsx | 7 ++++--- packages/core/EventManager.ts | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index 7286d23211..3bbc90570a 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -187,7 +187,11 @@ function BookingListItem(booking: BookingItemProps) { if ( newLocationType === LocationType.InPerson || newLocationType === LocationType.Link || - newLocationType === LocationType.UserPhone + newLocationType === LocationType.UserPhone || + newLocationType === LocationType.Riverside || + newLocationType === LocationType.Around || + newLocationType === LocationType.Whereby || + newLocationType === LocationType.Ping ) { newLocation = details[Object.keys(details)[0]]; } diff --git a/apps/web/components/booking/pages/AvailabilityPage.tsx b/apps/web/components/booking/pages/AvailabilityPage.tsx index 914fb24a53..52f43c03b7 100644 --- a/apps/web/components/booking/pages/AvailabilityPage.tsx +++ b/apps/web/components/booking/pages/AvailabilityPage.tsx @@ -55,6 +55,7 @@ export const locationKeyToString = (location: LocationObject, t: TFunction) => { case LocationType.Link: case LocationType.Ping: case LocationType.Riverside: + case LocationType.Around: case LocationType.Whereby: return location.link || "Link"; // If disabled link won't exist on the object case LocationType.Phone: @@ -606,7 +607,7 @@ const AvailabilityPage = ({ profile, eventType }: Props) => { )} {eventType.locations.length === 1 && ( -

+

{Object.values(AppStoreLocationType).includes( eventType.locations[0].type as unknown as AppStoreLocationType ) ? ( @@ -619,11 +620,11 @@ const AvailabilityPage = ({ profile, eventType }: Props) => {

)} {eventType.locations.length > 1 && ( -
+
-

+

{eventType.locations.map((el, i, arr) => { return ( diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts index 7de51642a4..f2173eb4e0 100644 --- a/packages/core/EventManager.ts +++ b/packages/core/EventManager.ts @@ -172,7 +172,10 @@ export default class EventManager { } // Update the calendar event with the proper video call data - results.push(...(await this.updateAllCalendarEvents(evt, booking))); + const calendarReference = booking.references.find((reference) => reference.type.includes("_calendar")); + if (calendarReference) { + results.push(...(await this.updateAllCalendarEvents(evt, booking))); + } const referencesToCreate = results.map((result) => { return { @@ -430,7 +433,6 @@ export default class EventManager { try { // Bookings should only have one calendar reference calendarReference = booking.references.filter((reference) => reference.type.includes("_calendar"))[0]; - if (!calendarReference) throw new Error("bookingRef"); const { uid: bookingRefUid, externalCalendarId: bookingExternalCalendarId } = calendarReference;