Skip to content

Scheduling infrastructure for absolutely everyone.

Fix providerName (#2589)

sean-brydon6197ae25c6c3
diff --git a/apps/web/lib/emails/templates/attendee-scheduled-email.ts b/apps/web/lib/emails/templates/attendee-scheduled-email.ts
index 96586c67092..1a4c045bb83 100644
--- a/apps/web/lib/emails/templates/attendee-scheduled-email.ts
+++ b/apps/web/lib/emails/templates/attendee-scheduled-email.ts
@@ -320,7 +320,8 @@ ${getRichDescription(this.calEvent)}
}
protected getLocation(): string {
- let providerName = this.calEvent.location ? getAppName(this.calEvent.location) : "";
+ let providerName = this.calEvent.location && getAppName(this.calEvent.location);
+
if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
const location = this.calEvent.location.split(":")[1];
providerName = location[0].toUpperCase() + location.slice(1);
diff --git a/apps/web/lib/emails/templates/organizer-scheduled-email.ts b/apps/web/lib/emails/templates/organizer-scheduled-email.ts
index d16e5462e0d..5d8719243d2 100644
--- a/apps/web/lib/emails/templates/organizer-scheduled-email.ts
+++ b/apps/web/lib/emails/templates/organizer-scheduled-email.ts
@@ -313,7 +313,7 @@ ${getRichDescription(this.calEvent)}
}
protected getLocation(): string {
- let providerName = this.calEvent.location ? getAppName(this.calEvent.location) : "";
+ let providerName = this.calEvent.location && getAppName(this.calEvent.location); // This returns null if nothing is found
if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
const location = this.calEvent.location.split(":")[1];
diff --git a/packages/app-store/utils.ts b/packages/app-store/utils.ts
index ed61dde2f25..ae27fd659b1 100644
--- a/packages/app-store/utils.ts
+++ b/packages/app-store/utils.ts
@@ -128,8 +128,8 @@ export function getLocationLabels(t: TFunction) {
}, defaultLocationLabels);
}
-export function getAppName(name: string) {
- return ALL_APPS_MAP[name as keyof typeof ALL_APPS_MAP]?.name || "No App Name";
+export function getAppName(name: string): string | null {
+ return ALL_APPS_MAP[name as keyof typeof ALL_APPS_MAP]?.name ?? null;
}
export function getAppType(name: string): string {
diff --git a/packages/app-store/wipemycalother/lib/templates/base-template.ts b/packages/app-store/wipemycalother/lib/templates/base-template.ts
index cf0479bcf8d..fe48304c729 100644
--- a/packages/app-store/wipemycalother/lib/templates/base-template.ts
+++ b/packages/app-store/wipemycalother/lib/templates/base-template.ts
@@ -313,7 +313,7 @@ ${getRichDescription(this.calEvent)}
}
protected getLocation(): string {
- let providerName = this.calEvent.location ? getAppName(this.calEvent.location) : "";
+ let providerName = this.calEvent.location && getAppName(this.calEvent.location);
if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
const location = this.calEvent.location.split(":")[1];