fix: show email in outlook (#5897)
* fix: change external id to owner address Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * feat: add email prop in calendar Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: only display for outlook Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: add email for apple calendar Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: type error and use description Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: try using email from /me endpoint Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: fallback to principal name when mail is not there Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * chore: use empty string for fallback Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
This commit is contained in:
co-authored by
Peer Richelsen
kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Joe Au-Yeung
parent
9487819ec1
commit
2d9064e92f
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
}) || []
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}, []);
|
||||
|
||||
Vendored
+2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user