fix: cascade organization hideBranding setting to user and team events (#21703)
- Add utility function for cascading hideBranding logic - Update all getServerSideProps files to check organization hideBranding as fallback - Ensure team queries include parent hideBranding data - Fix hideBranding not working for organization members and teams Fixes the issue where organization-level branding settings were not being applied to user and team event pages when the direct entity didn't have hideBranding enabled. Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
1 parent
2aaf672b10
commit
2fcb8a750d
10 files changed
+220
-7
No files matched your search
@@ -1,7 +1,9 @@
|
||||
import type { GetServerSidePropsContext } from "next";
|
||||
import { z } from "zod";
|
||||
|
||||
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
|
||||
import { getClientSecretFromPayment } from "@calcom/features/ee/payments/pages/getClientSecretFromPayment";
|
||||
import { shouldHideBrandingForEvent } from "@calcom/lib/hideBranding";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { BookingStatus } from "@calcom/prisma/enums";
|
||||
import { paymentDataSelect } from "@calcom/prisma/selects/payment";
|
||||
@@ -16,6 +18,8 @@ const querySchema = z.object({
|
||||
|
||||
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
|
||||
const { uid } = querySchema.parse(context.query);
|
||||
const { currentOrgDomain } = orgDomainConfig(context.req);
|
||||
|
||||
const rawPayment = await prisma.payment.findFirst({
|
||||
where: {
|
||||
uid,
|
||||
@@ -51,7 +55,12 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
const profile = {
|
||||
name: eventType.team?.name || user?.name || null,
|
||||
theme: (!eventType.team?.name && user?.theme) || null,
|
||||
hideBranding: eventType.team?.hideBranding || user?.hideBranding || null,
|
||||
hideBranding: await shouldHideBrandingForEvent({
|
||||
eventTypeId: eventType.id,
|
||||
team: eventType.team,
|
||||
owner: eventType.users[0] ?? null,
|
||||
orgSlug: currentOrgDomain,
|
||||
}),
|
||||
};
|
||||
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user