Skip to content

Comments

chore: hide cal branding for platform bookings#22979

Merged
supalarry merged 5 commits intomainfrom
lauris/cal-6222-chore-remove-cal-branding-in-booking-page-for-platform
Aug 20, 2025
Merged

chore: hide cal branding for platform bookings#22979
supalarry merged 5 commits intomainfrom
lauris/cal-6222-chore-remove-cal-branding-in-booking-page-for-platform

Conversation

@supalarry
Copy link
Contributor

@supalarry supalarry commented Aug 8, 2025

Linear CAL-6222

Fixes #22978

@supalarry supalarry requested a review from a team August 8, 2025 13:21
@supalarry supalarry requested a review from a team as a code owner August 8, 2025 13:21
@linear
Copy link

linear bot commented Aug 8, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

"""

Walkthrough

The changes introduce new fields to user and team selection objects in database queries to retrieve isPlatformManaged for users and createdByOAuthClientId for teams. The booking page logic is updated to check these fields and, if a booking is platform-managed or created by an OAuth client, the hideBranding property is set to true, ensuring branding is hidden for such bookings. Additionally, a default value for isPlatformManaged is added to the default user object, and the user selection for availability now includes isPlatformManaged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove branding ("Create your own booking link") from booking confirmation page for platform bookings (CAL-6222)
Hide branding for bookings where the owner or team is platform-managed (CAL-6222)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were identified. All code modifications are directly related to hiding branding for platform-managed bookings as described in the linked issue.
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21be01f and bd7b1e1.

📒 Files selected for processing (1)
  • packages/lib/defaultEvents.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/lib/defaultEvents.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lauris/cal-6222-chore-remove-cal-branding-in-booking-page-for-platform

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app graphite-app bot requested a review from a team August 8, 2025 13:21
@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Aug 8, 2025
@graphite-app graphite-app bot requested a review from a team August 8, 2025 13:22
@dosubot dosubot bot added the bookings area: bookings, availability, timezones, double booking label Aug 8, 2025
@graphite-app
Copy link

graphite-app bot commented Aug 8, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/08/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add platform team as reviewer" took an action on this PR • (08/08/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
apps/web/lib/booking.ts (1)

166-175: Prisma guideline: replace include with select

Org standard is “only select what you need; never use include”. This query can use select to fetch only data and attendee fields.

-    seatAttendee = await prisma.bookingSeat.findUnique({
-      where: {
-        referenceUid: seatReferenceUid,
-      },
-      include: {
-        attendee: {
-          select: {
-            name: true,
-            email: true,
-            phoneNumber: true,
-          },
-        },
-      },
-    });
+    seatAttendee = await prisma.bookingSeat.findUnique({
+      where: { referenceUid: seatReferenceUid },
+      select: {
+        data: true,
+        attendee: {
+          select: { name: true, email: true, phoneNumber: true },
+        },
+      },
+    });

If you adopt the above, adjust the local type alias accordingly (outside the changed lines), e.g.:

type SeatAttendee =
  | {
      attendee: { email: string; name: string; phoneNumber: string | null };
      data: Prisma.JsonValue;
    }
  | null;
let seatAttendee: SeatAttendee = null;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe6540 and 21be01f.

📒 Files selected for processing (4)
  • apps/web/lib/booking.ts (2 hunks)
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx (1 hunks)
  • packages/lib/defaultEvents.ts (1 hunks)
  • packages/prisma/selects/user.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/prisma/selects/user.ts
  • apps/web/lib/booking.ts
  • packages/lib/defaultEvents.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/prisma/selects/user.ts
  • apps/web/lib/booking.ts
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
  • packages/lib/defaultEvents.ts
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
🧠 Learnings (11)
📓 Common learnings
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts:118-143
Timestamp: 2025-08-08T09:29:11.665Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts (TypeScript), the AIPhoneServiceAgentListItem is required to include user.email in listAgents responses (per maintainer Udit-takkar). Future reviews should not flag this as unnecessary PII unless requirements change.
📚 Learning: 2025-08-08T09:29:11.665Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts:118-143
Timestamp: 2025-08-08T09:29:11.665Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts (TypeScript), the AIPhoneServiceAgentListItem is required to include user.email in listAgents responses (per maintainer Udit-takkar). Future reviews should not flag this as unnecessary PII unless requirements change.

Applied to files:

  • packages/prisma/selects/user.ts
  • apps/web/lib/booking.ts
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
  • packages/lib/defaultEvents.ts
📚 Learning: 2025-07-28T11:50:23.946Z
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.ts : For Prisma queries, only select data you need; never use `include`, always use `select`

Applied to files:

  • packages/prisma/selects/user.ts
📚 Learning: 2025-08-05T07:42:06.335Z
Learnt from: sean-brydon
PR: calcom/cal.com#22618
File: packages/trpc/server/routers/viewer/eventTypes/utils/transformUtils.ts:113-113
Timestamp: 2025-08-05T07:42:06.335Z
Learning: In Cal.com's getUserEventGroups handler refactor (PR #22618), the membershipCount field for team event groups is intentionally set to 0 in the new createTeamEventGroup function, as confirmed by sean-brydon (PR author). This preserves the same behavior as the old implementation that was being refactored, maintaining backward compatibility. While other parts of the codebase may use actual member counts, this specific implementation maintains the previous behavior.

Applied to files:

  • apps/web/lib/booking.ts
📚 Learning: 2025-08-05T07:42:06.335Z
Learnt from: sean-brydon
PR: calcom/cal.com#22618
File: packages/trpc/server/routers/viewer/eventTypes/utils/transformUtils.ts:113-113
Timestamp: 2025-08-05T07:42:06.335Z
Learning: In Cal.com's event type system, the membershipCount field for team event groups is intentionally set to 0, as confirmed by sean-brydon (PR author). This behavior was preserved during the refactor from the old getUserEventGroups.handler.ts implementation to the new createTeamEventGroup function in transformUtils.ts. This is not a bug but the intended behavior that maintains consistency with the previous implementation.

Applied to files:

  • apps/web/lib/booking.ts
📚 Learning: 2025-08-05T12:04:29.037Z
Learnt from: din-prajapati
PR: calcom/cal.com#21854
File: packages/app-store/office365calendar/__tests__/unit_tests/SubscriptionManager.test.ts:0-0
Timestamp: 2025-08-05T12:04:29.037Z
Learning: In packages/app-store/office365calendar/lib/CalendarService.ts, the fetcher method in Office365CalendarService class is public, not private. It was specifically changed from private to public in this PR to support proper testing and external access patterns.

Applied to files:

  • apps/web/lib/booking.ts
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
📚 Learning: 2025-08-05T07:42:06.335Z
Learnt from: sean-brydon
PR: calcom/cal.com#22618
File: packages/trpc/server/routers/viewer/eventTypes/utils/transformUtils.ts:113-113
Timestamp: 2025-08-05T07:42:06.335Z
Learning: In Cal.com's event type system, the membershipCount field for team event groups is intentionally hard-coded to 0, as confirmed by sean-brydon. This behavior was preserved during the refactor from the old getUserEventGroups.handler.ts implementation to the new createTeamEventGroup function in transformUtils.ts. This is not a bug but the intended behavior.

Applied to files:

  • apps/web/lib/booking.ts
📚 Learning: 2025-07-15T12:59:34.389Z
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Applied to files:

  • apps/web/lib/booking.ts
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
📚 Learning: 2025-07-24T08:39:06.185Z
Learnt from: eunjae-lee
PR: calcom/cal.com#22702
File: packages/lib/server/service/insightsBooking.ts:120-124
Timestamp: 2025-07-24T08:39:06.185Z
Learning: In the InsightsBookingService (packages/lib/server/service/insightsBooking.ts), the constructor stores null for invalid options or filters but this is handled safely through null checks in buildFilterConditions() and buildAuthorizationConditions() methods. The service uses defensive programming to return safe fallback conditions (null or NOTHING_CONDITION) rather than throwing errors on invalid inputs.

Applied to files:

  • apps/web/lib/booking.ts
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
📚 Learning: 2025-08-08T09:27:23.870Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/providers/retellAI/services/AgentService.ts:195-216
Timestamp: 2025-08-08T09:27:23.870Z
Learning: In PR calcom/cal.com#22919, file packages/features/calAIPhone/providers/retellAI/services/AgentService.ts, the updateAgentConfiguration method intentionally does not persist the optional `name` parameter to the repository for now, per maintainer (Udit-takkar). Future reviews should not flag this unless requirements change.

Applied to files:

  • apps/web/lib/booking.ts
  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
📚 Learning: 2025-07-21T21:33:23.371Z
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.371Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.

Applied to files:

  • apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
🧬 Code Graph Analysis (1)
apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx (1)
packages/lib/hideBranding.ts (1)
  • shouldHideBrandingForEvent (76-113)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Detect changes
🔇 Additional comments (4)
packages/prisma/selects/user.ts (1)

13-13: Add isPlatformManaged to user selects — LGTM

Selecting this boolean on availabilityUserSelect/baseUserSelect is consistent with the PR goals and low-risk.

packages/lib/defaultEvents.ts (1)

59-59: Default user now includes isPlatformManaged: false — LGTM

Keeps getDefaultEvent paths type-safe and aligned with new UI logic.

apps/web/lib/booking.ts (2)

20-21: Selecting isPlatformManaged on users — LGTM

Required for platform-branding logic downstream.


68-81: Selecting createdByOAuthClientId on team — LGTM; confirm parent-team handling

This enables platform detection for team events. If platform status can be inherited from a parent team, consider also selecting parent.createdByOAuthClientId.

Comment on lines +231 to +244
const isPlatformBooking = eventType.users[0]?.isPlatformManaged || eventType.team?.createdByOAuthClientId;

return {
props: {
orgSlug: currentOrgDomain,
themeBasis: eventType.team ? eventType.team.slug : eventType.users[0]?.username,
hideBranding: await shouldHideBrandingForEvent({
eventTypeId: eventType.id,
team: eventType.team,
owner: eventType.users[0] ?? null,
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
}),
hideBranding: isPlatformBooking
? true
: await shouldHideBrandingForEvent({
eventTypeId: eventType.id,
team: eventType.team,
owner: eventType.users[0] ?? null,
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use owner.isPlatformManaged (not users[0]) and coerce to boolean

Relying on users[0] can be incorrect for multi-host/team events where the “owner” differs from the first user. Also coerce to boolean for clarity.

-  const isPlatformBooking = eventType.users[0]?.isPlatformManaged || eventType.team?.createdByOAuthClientId;
+  const isPlatformBooking = !!(
+    eventType.owner?.isPlatformManaged || eventType.team?.createdByOAuthClientId
+  );

Optionally align the downstream call to use owner when available:

-      owner: eventType.users[0] ?? null,
+      owner: eventType.owner ?? eventType.users[0] ?? null,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isPlatformBooking = eventType.users[0]?.isPlatformManaged || eventType.team?.createdByOAuthClientId;
return {
props: {
orgSlug: currentOrgDomain,
themeBasis: eventType.team ? eventType.team.slug : eventType.users[0]?.username,
hideBranding: await shouldHideBrandingForEvent({
eventTypeId: eventType.id,
team: eventType.team,
owner: eventType.users[0] ?? null,
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
}),
hideBranding: isPlatformBooking
? true
: await shouldHideBrandingForEvent({
eventTypeId: eventType.id,
team: eventType.team,
owner: eventType.users[0] ?? null,
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
}),
const isPlatformBooking = !!(
eventType.owner?.isPlatformManaged || eventType.team?.createdByOAuthClientId
);
return {
props: {
orgSlug: currentOrgDomain,
themeBasis: eventType.team ? eventType.team.slug : eventType.users[0]?.username,
hideBranding: isPlatformBooking
? true
: await shouldHideBrandingForEvent({
eventTypeId: eventType.id,
team: eventType.team,
- owner: eventType.users[0] ?? null,
+ owner: eventType.owner ?? eventType.users[0] ?? null,
organizationId:
session?.user?.profile?.organizationId ??
session?.user?.org?.id ??
null,
}),
🤖 Prompt for AI Agents
In apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx
around lines 231 to 244, replace the usage of
eventType.users[0]?.isPlatformManaged with owner?.isPlatformManaged to correctly
reflect the event owner instead of the first user, and explicitly coerce this
value to a boolean. Also update the hideBranding call to use owner consistently
when available instead of users[0], ensuring the logic correctly handles
multi-host or team events.

@vercel
Copy link

vercel bot commented Aug 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Aug 19, 2025 9:24am
cal-eu Ignored Ignored Aug 19, 2025 9:24am

@github-actions github-actions bot added the 🧹 Improvements Improvements to existing features. Mostly UX/UI label Aug 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2025

E2E results are ready!

@supalarry supalarry merged commit b4d804d into main Aug 20, 2025
39 checks passed
@supalarry supalarry deleted the lauris/cal-6222-chore-remove-cal-branding-in-booking-page-for-platform branch August 20, 2025 15:27
@coderabbitai coderabbitai bot mentioned this pull request Sep 15, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking core area: core, team members only 🧹 Improvements Improvements to existing features. Mostly UX/UI platform Anything related to our platform plan ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: remove cal branding in booking page for platform bookings

5 participants