-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into fix/CAL-3578
- Loading branch information
Showing
80 changed files
with
1,636 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 16 additions & 2 deletions
18
apps/api/v2/src/modules/timezones/services/timezones.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
import { RedisService } from "@/modules/redis/redis.service"; | ||
import { Injectable } from "@nestjs/common"; | ||
|
||
import { cityTimezonesHandler } from "@calcom/platform-libraries"; | ||
import type { CityTimezones } from "@calcom/platform-libraries"; | ||
|
||
@Injectable() | ||
export class TimezonesService { | ||
async getCityTimeZones() { | ||
return cityTimezonesHandler(); | ||
private cacheKey = "cityTimezones"; | ||
|
||
constructor(private readonly redisService: RedisService) {} | ||
|
||
async getCityTimeZones(): Promise<CityTimezones> { | ||
const cachedTimezones = await this.redisService.redis.get(this.cacheKey); | ||
if (!cachedTimezones) { | ||
const timezones = await cityTimezonesHandler(); | ||
await this.redisService.redis.set(this.cacheKey, JSON.stringify(timezones), "EX", 60 * 60 * 24); | ||
|
||
return timezones; | ||
} else { | ||
return JSON.parse(cachedTimezones) as CityTimezones; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
apps/web/playwright/organization/lib/gotoPathAndExpectRedirectToOrgDomain.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { Page } from "@playwright/test"; | ||
import { expect } from "@playwright/test"; | ||
|
||
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains"; | ||
|
||
export async function gotoPathAndExpectRedirectToOrgDomain({ | ||
page, | ||
org, | ||
path, | ||
expectedPath, | ||
}: { | ||
page: Page; | ||
org: { slug: string | null }; | ||
path: string; | ||
expectedPath: string; | ||
}) { | ||
if (!org.slug) { | ||
throw new Error("Org slug is not defined"); | ||
} | ||
page.goto(path).catch((e) => { | ||
console.log("Expected navigation error to happen"); | ||
}); | ||
|
||
const orgSlug = org.slug; | ||
|
||
const orgRedirectUrl = await new Promise(async (resolve) => { | ||
page.on("request", (request) => { | ||
if (request.isNavigationRequest()) { | ||
const requestedUrl = request.url(); | ||
console.log("Requested navigation to", requestedUrl); | ||
// Resolve on redirection to org domain | ||
if (requestedUrl.includes(orgSlug)) { | ||
resolve(requestedUrl); | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
expect(orgRedirectUrl).toContain(`${getOrgFullOrigin(org.slug)}${expectedPath}`); | ||
} |
Oops, something went wrong.