Scheduling infrastructure for absolutely everyone.
fix: show email in outlook (#5897)
Udit Takkar2d9064e92f2e
diff --git a/apps/web/components/apps/CalendarListContainer.tsx b/apps/web/components/apps/CalendarListContainer.tsxindex 39d04eb38dd..84911a79598 100644--- a/apps/web/components/apps/CalendarListContainer.tsx+++ b/apps/web/components/apps/CalendarListContainer.tsx@@ -159,6 +159,7 @@ function ConnectedCalendarsList(props: Props) {if (!data.connectedCalendars.length) {return null;}+return (<List className="flex flex-col gap-6" noBorderTreatment>{data.connectedCalendars.map((item) => (@@ -168,7 +169,7 @@ function ConnectedCalendarsList(props: Props) {slug={item.integration.slug}title={item.integration.title}logo={item.integration.logo}- description={item.primary?.externalId || "No external Id"}+ description={item.primary?.email ?? item.integration.description}separate={true}actions={<div className="flex w-32 justify-end">diff --git a/packages/app-store/googlecalendar/lib/CalendarService.ts b/packages/app-store/googlecalendar/lib/CalendarService.tsindex 1b81ca52f77..a420bcefc39 100644--- a/packages/app-store/googlecalendar/lib/CalendarService.ts+++ b/packages/app-store/googlecalendar/lib/CalendarService.ts@@ -372,6 +372,7 @@ export default class GoogleCalendarService implements Calendar {name: cal.summary ?? "No name",primary: cal.primary ?? false,readOnly: !(cal.accessRole === "reader" || cal.accessRole === "owner") && true,+ email: cal.id ?? "",};return calendar;}) || []diff --git a/packages/app-store/larkcalendar/lib/CalendarService.ts b/packages/app-store/larkcalendar/lib/CalendarService.tsindex 9080d0c9b39..5df551a6c96 100644--- a/packages/app-store/larkcalendar/lib/CalendarService.ts+++ b/packages/app-store/larkcalendar/lib/CalendarService.ts@@ -319,6 +319,7 @@ export default class LarkCalendarService implements Calendar {integration: this.integrationName,name: cal.summary_alias || cal.summary || "No calendar name",primary: cal.type === "primary",+ email: cal.calendar_id ?? "",};return calendar;});@@ -339,6 +340,7 @@ export default class LarkCalendarService implements Calendar {integration: this.integrationName,name: cal.summary_alias || cal.summary || "No calendar name",primary: cal.type === "primary",+ email: cal.calendar_id ?? "",};return calendar;});diff --git a/packages/app-store/office365calendar/lib/CalendarService.ts b/packages/app-store/office365calendar/lib/CalendarService.tsindex 82874048860..6823ce0823c 100644--- a/packages/app-store/office365calendar/lib/CalendarService.ts+++ b/packages/app-store/office365calendar/lib/CalendarService.ts@@ -1,4 +1,4 @@-import { Calendar as OfficeCalendar } from "@microsoft/microsoft-graph-types-beta";+import { Calendar as OfficeCalendar, User } from "@microsoft/microsoft-graph-types-beta";import { getLocation, getRichDescription } from "@calcom/lib/CalEventParser";import { handleErrorsJson, handleErrorsRaw } from "@calcom/lib/errors";@@ -182,6 +182,10 @@ export default class Office365CalendarService implements Calendar {}}+ const user = await this.fetcher("/me");+ const userResponseBody = await handleErrorsJson<User>(user);+ const email = userResponseBody.mail ?? userResponseBody.userPrincipalName;+return officeCalendars.map((cal: OfficeCalendar) => {const calendar: IntegrationCalendar = {externalId: cal.id ?? "No Id",@@ -189,6 +193,7 @@ export default class Office365CalendarService implements Calendar {name: cal.name ?? "No calendar name",primary: cal.isDefaultCalendar ?? false,readOnly: !cal.canEdit && true,+ email: email ?? "",};return calendar;});diff --git a/packages/features/calendars/DestinationCalendarSelector.tsx b/packages/features/calendars/DestinationCalendarSelector.tsxindex 4d6b5d215bd..3efe0f4d281 100644--- a/packages/features/calendars/DestinationCalendarSelector.tsx+++ b/packages/features/calendars/DestinationCalendarSelector.tsx@@ -102,7 +102,9 @@ const DestinationCalendarSelector = ({query.data.connectedCalendars.map((selectedCalendar) => ({key: selectedCalendar.credentialId,label: `${selectedCalendar.integration.title?.replace(/calendar/i, "")} (${- selectedCalendar.primary?.name+ selectedCalendar.primary?.integration === "office365_calendar"+ ? selectedCalendar.primary?.email+ : selectedCalendar.primary?.name})`,options: (selectedCalendar.calendars ?? []).filter((cal) => cal.readOnly === false)diff --git a/packages/lib/CalendarService.ts b/packages/lib/CalendarService.tsindex 38cf6c6d282..71d9a1736b3 100644--- a/packages/lib/CalendarService.ts+++ b/packages/lib/CalendarService.ts@@ -420,6 +420,7 @@ export default abstract class BaseCalendarService implements Calendar {? event.destinationCalendar.externalId === calendar.url: false,integration: this.integrationName,+ email: this.credentials.username ?? "",});return newCalendars;}, []);diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.tsindex 2dde1492cb3..9141e80e34f 100644--- a/packages/types/Calendar.d.ts+++ b/packages/types/Calendar.d.ts@@ -178,6 +178,8 @@ export interface IntegrationCalendar extends Ensure<Partial<SelectedCalendar>, "primary?: boolean;name?: string;readOnly?: boolean;+ // For displaying the connected email address+ email?: string;}export interface Calendar {