fix: Add organization logo to org dynamic events (#15082)
* fix: Add organization logo to org dynamic events * Slow typescript strikes again --------- Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
This commit is contained in:
co-authored by
sean-brydon
parent
7d7e0ae6a7
commit
99d4461dcc
@@ -91,6 +91,16 @@ test("dynamic booking info prefilled by query params", async ({ page, users }) =
|
||||
activeState = await badgeLocator.getAttribute("data-active");
|
||||
expect(activeState).toEqual("false");
|
||||
});
|
||||
// eslint-disable-next-line playwright/no-skipped-test
|
||||
test.skip("it contains the right event details", async ({ page }) => {
|
||||
const response = await page.goto(`http://acme.cal.local:3000/owner1+member1`);
|
||||
expect(response?.status()).toBe(200);
|
||||
|
||||
expect(await page.locator('[data-testid="event-title"]').textContent()).toBe("Group Meeting");
|
||||
expect(await page.locator('[data-testid="event-meta"]').textContent()).toContain("Acme Inc");
|
||||
|
||||
expect((await page.locator('[data-testid="event-meta"] [data-testid="avatar"]').all()).length).toBe(3);
|
||||
});
|
||||
|
||||
test.describe("Organization:", () => {
|
||||
test.afterEach(({ orgs, users }) => {
|
||||
|
||||
@@ -24,7 +24,6 @@ export const EventMembers = ({ schedulingType, users, profile, entity }: EventMe
|
||||
const isEmbed = useIsEmbed();
|
||||
const showMembers = !!schedulingType && schedulingType !== SchedulingType.ROUND_ROBIN;
|
||||
const shownUsers = showMembers ? users : [];
|
||||
|
||||
// In some cases we don't show the user's names, but only show the profile name.
|
||||
const showOnlyProfileName =
|
||||
(profile.name && schedulingType === SchedulingType.ROUND_ROBIN) ||
|
||||
@@ -37,7 +36,7 @@ export const EventMembers = ({ schedulingType, users, profile, entity }: EventMe
|
||||
size="sm"
|
||||
className="border-muted"
|
||||
items={[
|
||||
...(isDynamic
|
||||
...(isDynamic && !profile.image
|
||||
? []
|
||||
: [
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import type { Team } from "@calcom/prisma/client";
|
||||
import type { BookerLayoutSettings } from "@calcom/prisma/zod-utils";
|
||||
import {
|
||||
BookerLayouts,
|
||||
@@ -165,6 +166,19 @@ export const getPublicEvent = async (
|
||||
const disableBookingTitle = !defaultEvent.isDynamic;
|
||||
const unPublishedOrgUser = users.find((user) => user.profile?.organization?.slug === null);
|
||||
|
||||
let orgDetails: Pick<Team, "logoUrl" | "name"> | undefined;
|
||||
if (org) {
|
||||
orgDetails = await prisma.team.findFirstOrThrow({
|
||||
where: {
|
||||
slug: org,
|
||||
},
|
||||
select: {
|
||||
logoUrl: true,
|
||||
name: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
...defaultEvent,
|
||||
bookingFields: getBookingFieldsWithSystemFields({ ...defaultEvent, disableBookingTitle }),
|
||||
@@ -176,18 +190,20 @@ export const getPublicEvent = async (
|
||||
})),
|
||||
locations: privacyFilteredLocations(locations),
|
||||
profile: {
|
||||
username: users[0].username,
|
||||
name: users[0].name,
|
||||
weekStart: users[0].weekStart,
|
||||
image: getUserAvatarUrl({
|
||||
avatarUrl: users[0].avatarUrl,
|
||||
}),
|
||||
brandColor: users[0].brandColor,
|
||||
darkBrandColor: users[0].darkBrandColor,
|
||||
theme: null,
|
||||
bookerLayouts: bookerLayoutsSchema.parse(
|
||||
firstUsersMetadata?.defaultBookerLayouts || defaultEventBookerLayouts
|
||||
),
|
||||
...(orgDetails
|
||||
? {
|
||||
image: orgDetails?.logoUrl,
|
||||
name: orgDetails?.name,
|
||||
username: org,
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
entity: {
|
||||
considerUnpublished: !fromRedirectOfNonOrgLink && unPublishedOrgUser !== undefined,
|
||||
|
||||
Reference in New Issue
Block a user