From 3a2a70d83aef6de8feb0144e5c73f2c6697789ad Mon Sep 17 00:00:00 2001 From: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Date: Thu, 27 Jun 2024 22:32:19 +0200 Subject: [PATCH] fix: getPublicEventType of NonOrgUser fetch OrgUser event-type of same username (#15587) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: getPublicEventType of NonOrgUser fetch OrgUser event-type with same username * Fix the test that was supposed to verify the scenario --------- Co-authored-by: Hariom Co-authored-by: Omar López --- apps/web/playwright/organization/booking.e2e.ts | 11 ++++++++--- packages/features/eventtypes/lib/getPublicEvent.ts | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/web/playwright/organization/booking.e2e.ts b/apps/web/playwright/organization/booking.e2e.ts index 8f4042a99a..d044a07ac9 100644 --- a/apps/web/playwright/organization/booking.e2e.ts +++ b/apps/web/playwright/organization/booking.e2e.ts @@ -1,6 +1,7 @@ import type { Page } from "@playwright/test"; import { expect } from "@playwright/test"; import { JSDOM } from "jsdom"; +import { uuid } from "short-uuid"; import { getOrgUsernameFromEmail } from "@calcom/features/auth/signup/utils/getOrgUsernameFromEmail"; import { WEBAPP_URL } from "@calcom/lib/constants"; @@ -28,9 +29,9 @@ function getOrgOrigin(orgSlug: string | null) { } test.describe("Bookings", () => { - test.afterEach(({ orgs, users }) => { - orgs.deleteAll(); - users.deleteAll(); + test.afterEach(async ({ orgs, users, page }) => { + await users.deleteAll(); + await orgs.deleteAll(); }); test.describe("Team Event", () => { @@ -324,6 +325,8 @@ test.describe("Bookings", () => { const username = "john"; const userInsideOrganization = await users.create({ username, + useExactUsername: true, + email: `john-inside-${uuid()}@example.com`, name: "John Inside Organization", organizationId: org.id, roleInOrganization: MembershipRole.MEMBER, @@ -339,6 +342,8 @@ test.describe("Bookings", () => { const userOutsideOrganization = await users.create({ username, name: "John Outside Organization", + email: `john-outside-${uuid()}@example.com`, + useExactUsername: true, eventTypes: [ { title: "John Outside Org's Meeting", diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.ts index 0be34a70dd..754d10c85b 100644 --- a/packages/features/eventtypes/lib/getPublicEvent.ts +++ b/packages/features/eventtypes/lib/getPublicEvent.ts @@ -239,6 +239,7 @@ export const getPublicEvent = async ( } : { username, + profiles: { none: {} }, }), }, },