Skip to content

Comments

feat: enable cal-video-event-type-settings#23789

Closed
hemantmm wants to merge 23 commits intocalcom:mainfrom
hemantmm:cal-video-event-type-settings
Closed

feat: enable cal-video-event-type-settings#23789
hemantmm wants to merge 23 commits intocalcom:mainfrom
hemantmm:cal-video-event-type-settings

Conversation

@hemantmm
Copy link
Contributor

@hemantmm hemantmm commented Sep 12, 2025

closes: #21863

What does this PR do?

This PR enables Cal Video settings for event types by:

  1. Adding default Cal Video settings when initializing the form
  2. Including calVideoSettings in the payload when a Cal Video location is present
  3. Explicitly clearing calVideoSettings from the payload when Cal Video location is removed (to prevent stale settings from being submitted)

Updates since last revision

Addressed review feedback from @cubic-dev-ai:

  • Fixed issue where calVideoSettings was still being submitted even when the event no longer has a Cal Video location (the property was present from the spread in filteredPayload)
  • Added explicit delete filteredPayload.calVideoSettings when hasCalVideoLocation is false
  • Removed duplicate logic for setting calVideoSettings

Visual Demo (For contributors especially)

Video Demo (if applicable):

Before:

Screen.Recording.2025-09-12.at.16.32.36.mov

After:

Screen.Recording.2025-09-12.at.16.30.49.mov

Cal.com Atoms testing:

Screen.Recording.2025-09-17.at.15.21.58.online-video-cutter.com.online-video-cutter.com.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Create an event type with Cal Video as a location
  2. Save the event type - calVideoSettings should be included in the payload
  3. Remove Cal Video location from the event type
  4. Save again - calVideoSettings should NOT be included in the payload

Human Review Checklist

  • Verify that deleting calVideoSettings when Cal Video location is removed is the intended behavior
  • Confirm the logic correctly handles the case when calVideoSettings was previously set but Cal Video is no longer a location

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings

Link to Devin run: https://app.devin.ai/sessions/666a456bb2604467ab0a391c14e64184
Requested by: unknown ()

@hemantmm hemantmm requested a review from a team September 12, 2025 11:08
@hemantmm hemantmm requested a review from a team as a code owner September 12, 2025 11:08
@vercel
Copy link

vercel bot commented Sep 12, 2025

@hemantmm is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Sep 12, 2025
@graphite-app graphite-app bot requested a review from a team September 12, 2025 11:08
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 12, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds a defaultCalVideoSettings constant and uses it as the fallback when constructing form defaultValues and when preparing the submit payload. Detects cal video integration locations via hasCalVideoLocation (location.type === "integrations:daily") and, if present, ensures filteredPayload.calVideoSettings is populated from values.calVideoSettings or the default. Changes submit triggering to run when either a dirty field exists or a cal video location is present. Also includes a formatting change in .eslintrc.js (duplicate multiline message entry in an existing no-restricted-imports pattern). No exported/public signatures changed.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR also modifies .eslintrc.js by adding a duplicated multiline 'message' property inside a no-restricted-imports rule; this lint-config formatting change is unrelated to the linked issues about cal video settings and therefore counts as an out-of-scope change. Remove the .eslintrc.js formatting change from this PR and submit it as a separate cleanup/formatting PR, or document and justify the unrelated lint-config change in this PR description if it must remain included.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: enable cal-video-event-type-settings" is concise and accurately describes the primary change in this PR—enabling Cal video settings for event-type settings—so it clearly matches the changes and linked issues.
Linked Issues Check ✅ Passed The changes to packages/platform/atoms/event-types/hooks/useEventTypeForm.ts introduce defaultCalVideoSettings, apply it as a fallback for form default values, ensure calVideoSettings is added to the saved payload when a daily (cal-video) location exists, and trigger submission accordingly, which satisfies the linked issues' objectives to set defaults and add a CalVideoSettings entry on save.
Description Check ✅ Passed The PR description is related to the changeset: it references the linked issues (#21863, CAL-5942), summarizes the intent to enable Cal video settings, and includes demo links and checklist items, though the "How should this be tested?" section contains placeholders and could use concrete steps.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added platform Anything related to our platform plan ⚛️ atoms Created by Linear-GitHub Sync ✨ feature New feature or request labels Sep 12, 2025
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: 0

🧹 Nitpick comments (3)
packages/platform/atoms/event-types/hooks/useEventTypeForm.ts (3)

149-157: Avoid object aliasing; return a fresh, typed default each time

Using a shared object for defaults risks accidental mutation/aliasing with RHF state. Prefer a factory that returns a new, strongly-typed object.

-  const defaultCalVideoSettings = {
-    disableRecordingForGuests: false,
-    disableRecordingForOrganizer: false,
-    enableAutomaticTranscription: false,
-    enableAutomaticRecordingForOrganizer: false,
-    disableTranscriptionForGuests: false,
-    disableTranscriptionForOrganizer: false,
-    redirectUrlOnExit: null,
-  };
+  const defaultCalVideoSettings = (): NonNullable<FormValues["calVideoSettings"]> => ({
+    disableRecordingForGuests: false,
+    disableRecordingForOrganizer: false,
+    enableAutomaticTranscription: false,
+    enableAutomaticRecordingForOrganizer: false,
+    disableTranscriptionForGuests: false,
+    disableTranscriptionForOrganizer: false,
+    redirectUrlOnExit: null,
+  });

160-163: Initialize calVideoSettings with a fresh object

Call the factory to avoid sharing the same reference across forms.

-      calVideoSettings: eventType?.calVideoSettings ?? defaultCalVideoSettings,
+      calVideoSettings: eventType?.calVideoSettings ?? defaultCalVideoSettings(),

433-435: Avoid submitting unchanged forms solely due to a Cal Video location

Only submit when fields are dirty or when you need a one-time Cal Video settings upsert.

-    if (dirtyFieldExists || hasCalVideoLocation) {
+    if (dirtyFieldExists || (hasCalVideoLocation && !eventType.calVideoSettings)) {
       onSubmit({ ...filteredPayload, id: eventType.id });
     }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 74288b0 and 0ab6464.

📒 Files selected for processing (1)
  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts (2 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/platform/atoms/event-types/hooks/useEventTypeForm.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/platform/atoms/event-types/hooks/useEventTypeForm.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: anglerfishlyy
PR: calcom/cal.com#0
File: :0-0
Timestamp: 2025-08-27T16:39:38.192Z
Learning: anglerfishlyy successfully implemented CAL-3076 email invitation feature for Cal.com team event-types in PR #23312. The feature allows inviting people via email directly from assignment flow, with automatic team invitation if email doesn't belong to existing team member. Implementation includes Host type modifications (userId?: number, email?: string, isPending?: boolean), CheckedTeamSelect component updates with CreatableSelect, TRPC schema validation with zod email validation, and integration with existing teamInvite system.
📚 Learning: 2025-08-27T13:32:46.887Z
Learnt from: supalarry
PR: calcom/cal.com#23364
File: apps/api/v2/src/ee/event-types/event-types_2024_06_14/transformers/internal-to-api/internal-to-api.spec.ts:295-296
Timestamp: 2025-08-27T13:32:46.887Z
Learning: In calcom/cal.com, when transforming booking fields from internal to API format, tests in organizations-event-types.e2e-spec.ts already expect name field label and placeholder to be empty strings ("") rather than undefined. PR changes that set these to explicit empty strings are typically fixing implementation to match existing test expectations rather than breaking changes.

Applied to files:

  • packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
🧬 Code graph analysis (1)
packages/platform/atoms/event-types/hooks/useEventTypeForm.ts (1)
packages/features/eventtypes/lib/types.ts (1)
  • FormValues (78-175)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
packages/platform/atoms/event-types/hooks/useEventTypeForm.ts (1)

427-431: Verify canonical Cal Video location type; gate calVideoSettings upsert

rg failed to scan .tsx files ("unrecognized file type: tsx"); the canonical Cal Video location type (whether "integrations:daily", "integrations:cal-video", or both) couldn't be confirmed. Confirm canonical type(s) and update the allowlist. Only upsert calVideoSettings when a Cal Video location exists AND the event lacks settings or calVideoSettings was edited to avoid unnecessary writes.

File: packages/platform/atoms/event-types/hooks/useEventTypeForm.ts (around lines 427–431)

-    const hasCalVideoLocation = (values.locations ?? []).some((loc) => loc.type === "integrations:daily");
-
-    if (hasCalVideoLocation) {
-      filteredPayload.calVideoSettings = values.calVideoSettings ?? defaultCalVideoSettings;
-    }
+    // TODO: adjust the allowlist after verification
+    const isCalVideoType = (t: string) =>
+      ["integrations:cal-video", "integrations:daily"].includes(t);
+    const hasCalVideoLocation = (values.locations ?? []).some((loc) => isCalVideoType(loc.type));
+
+    const shouldUpsertCalVS =
+      hasCalVideoLocation &&
+      (!eventType.calVideoSettings || ("calVideoSettings" in dirtyValues));
+
+    if (shouldUpsertCalVS) {
+      filteredPayload.calVideoSettings = values.calVideoSettings ?? defaultCalVideoSettings();
+    }

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

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

Left a comment. Also the change should be tested in event type settings atom. As per your attached video you have shown the change in event type settings web and not atom. Can you update and test if this works for event settings in atom?

@kart1ka kart1ka marked this pull request as draft September 15, 2025 04:41
@pull-request-size pull-request-size bot added size/M and removed size/S labels Sep 15, 2025
@hemantmm hemantmm marked this pull request as ready for review September 15, 2025 16:34
@hemantmm hemantmm requested a review from kart1ka September 15, 2025 16:34
@dosubot dosubot bot added the event-types area: event types, event-types label Sep 15, 2025
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: 0

🧹 Nitpick comments (1)
.eslintrc.js (1)

28-34: Also block root imports (@calcom/trpc and @trpc).

"@calcom/trpc/*" doesn’t match the bare root import "@calcom/trpc". Add root entries to close this gap.

Apply:

           {
             patterns: [
               {
-                group: ["@calcom/trpc/*", "@trpc/*"],
+                group: ["@calcom/trpc", "@calcom/trpc/*", "@trpc", "@trpc/*"],
                 message:
                   "tRPC imports are blocked in packages/app-store. Move UI to apps/web/components/apps or introduce an API boundary.",
               },
             ],
           },
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab6464 and 2b38381.

📒 Files selected for processing (1)
  • .eslintrc.js (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: anglerfishlyy
PR: calcom/cal.com#0
File: :0-0
Timestamp: 2025-08-27T16:39:38.192Z
Learning: anglerfishlyy successfully implemented CAL-3076 email invitation feature for Cal.com team event-types in PR #23312. The feature allows inviting people via email directly from assignment flow, with automatic team invitation if email doesn't belong to existing team member. Implementation includes Host type modifications (userId?: number, email?: string, isPending?: boolean), CheckedTeamSelect component updates with CreatableSelect, TRPC schema validation with zod email validation, and integration with existing teamInvite system.
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
.eslintrc.js (1)

23-36: Confirmed: core no-restricted-imports is in use — no change required.

packages/config/eslint-preset.js defines the core no-restricted-imports (no @typescript-eslint/no-restricted-imports found). The core rule doesn't support allowTypeImports, so omitting that option is correct.

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2b38381 and dde1cd3.

📒 Files selected for processing (1)
  • .eslintrc.js (1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
.eslintrc.js

[error] 31-32: This property is later overwritten by an object member with the same name.

Overwritten with this property.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property.

(lint/suspicious/noDuplicateObjectKeys)

Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

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

Have you tested if this works for cal.com atoms? I still do not see any loom video that shows this fix works for atoms. Can you please test this and attach a loom video of the same? We do not merge changes without proper video evidence attached.

@kart1ka kart1ka marked this pull request as draft September 16, 2025 15:24
hemantmm and others added 2 commits September 16, 2025 21:00
Signed-off-by: Hemant M Mehta <hemant29mehta@gmail.com>
@pull-request-size pull-request-size bot added size/S and removed size/M labels Sep 16, 2025
@hemantmm
Copy link
Contributor Author

@kart1ka, I have tested in Cal.com atoms as well. Here is the video

Screen.Recording.2025-09-17.at.15.21.58.online-video-cutter.com.online-video-cutter.com.mp4

@hemantmm hemantmm marked this pull request as ready for review September 17, 2025 12:15
@hemantmm hemantmm requested a review from kart1ka September 17, 2025 12:15
@github-actions
Copy link
Contributor

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Oct 12, 2025
@github-actions github-actions bot removed the Stale label Oct 13, 2025
@hemantmm
Copy link
Contributor Author

hemantmm commented Nov 3, 2025

@kart1ka, can you review this PR?

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/platform/atoms/event-types/hooks/useEventTypeForm.ts">

<violation number="1" location="packages/platform/atoms/event-types/hooks/useEventTypeForm.ts:429">
calVideoSettings still gets submitted even when the event no longer has a Cal Video location because the property was already present on filteredPayload from the spread above; we need to explicitly clear it when hasCalVideoLocation is false so the guard is effective.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@github-actions
Copy link
Contributor

Devin AI is completing this stale PR

This PR by @hemantmm has been marked as stale. A Devin session has been created to complete the remaining work.

View Devin Session


Devin will review the PR, address any feedback, and push updates to complete this PR.

Address review feedback to explicitly delete calVideoSettings from the
payload when the event type no longer has a Cal Video location. This
prevents stale calVideoSettings from being submitted.

Also removed duplicate logic for setting calVideoSettings.

Co-authored-by: hemantmm <hemantmm@users.noreply.github.com>
Co-Authored-By: unknown <>
@calcom-bot calcom-bot removed the Stale label Jan 15, 2026
@devin-ai-integration
Copy link
Contributor

Completed Work

I've addressed the review feedback from @cubic-dev-ai and cleaned up the code:

Changes Made

  1. Fixed the issue where calVideoSettings was still being submitted when Cal Video location was removed - Added explicit delete filteredPayload.calVideoSettings when hasCalVideoLocation is false. This ensures that stale calVideoSettings are not submitted when the event type no longer has a Cal Video location.

  2. Removed duplicate logic - The original code had duplicate logic for setting calVideoSettings (once before the dirty check and once inside). This has been consolidated into a single, cleaner block.

Code Changes

if (hasCalVideoLocation) {
  filteredPayload.calVideoSettings = values.calVideoSettings ?? defaultCalVideoSettings;
+} else {
+  delete filteredPayload.calVideoSettings;
}

-const calVideoSettingsDirty = !!dirtyFields.calVideoSettings;
-
-if (dirtyFieldExists || calVideoSettingsDirty) {
-  if (hasCalVideoLocation) {
-    filteredPayload.calVideoSettings = values.calVideoSettings ?? defaultCalVideoSettings;
-  }
+if (dirtyFieldExists) {
  onSubmit({ ...filteredPayload, id: eventType.id });
}

Verification

  • Type-check passed locally
  • Lint passed locally (only pre-existing warnings, no new errors)

The PR is ready for review. Credit to @hemantmm for the original implementation.

Copy link
Contributor

@Ryukemeister Ryukemeister left a comment

Choose a reason for hiding this comment

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

hi @hemantmm, thank you for your contribution. however this is not the correct implementation for the fix. the issue mentioned in #21863 is not feasible for atoms, i've explained it in detail there. i'm gonna close this PR for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚛️ atoms Created by Linear-GitHub Sync community Created by Linear-GitHub Sync event-types area: event types, event-types ✨ feature New feature or request Low priority Created by Linear-GitHub Sync platform Anything related to our platform plan size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: enable cal video settings in event type settings atom

5 participants