Fix providerName (#2589)

Co-authored-by: Omar López <zomars@me.com>
This commit is contained in:
sean-brydon 2022-04-26 05:20:13 +01:00 committed by GitHub
parent fd73a4ac92
commit 9fffaa20a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View file

@ -320,7 +320,8 @@ ${getRichDescription(this.calEvent)}
} }
protected getLocation(): string { 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:")) { if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
const location = this.calEvent.location.split(":")[1]; const location = this.calEvent.location.split(":")[1];
providerName = location[0].toUpperCase() + location.slice(1); providerName = location[0].toUpperCase() + location.slice(1);

View file

@ -313,7 +313,7 @@ ${getRichDescription(this.calEvent)}
} }
protected getLocation(): string { 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:")) { if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
const location = this.calEvent.location.split(":")[1]; const location = this.calEvent.location.split(":")[1];

View file

@ -128,8 +128,8 @@ export function getLocationLabels(t: TFunction) {
}, defaultLocationLabels); }, defaultLocationLabels);
} }
export function getAppName(name: string) { export function getAppName(name: string): string | null {
return ALL_APPS_MAP[name as keyof typeof ALL_APPS_MAP]?.name || "No App Name"; return ALL_APPS_MAP[name as keyof typeof ALL_APPS_MAP]?.name ?? null;
} }
export function getAppType(name: string): string { export function getAppType(name: string): string {

View file

@ -313,7 +313,7 @@ ${getRichDescription(this.calEvent)}
} }
protected getLocation(): string { 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:")) { if (this.calEvent.location && this.calEvent.location.includes("integrations:")) {
const location = this.calEvent.location.split(":")[1]; const location = this.calEvent.location.split(":")[1];