Skip to content

Conversation

anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Sep 2, 2025

What does this PR do?

fixes #21002

Adds an organization-level setting to disable autofill on booking pages. This allows organization admins to prevent booking forms from being pre-filled with URL parameters for all users in the organization.

Key Changes:

  • Creates DisableAutofillOnBookingPageSwitch component following existing org settings patterns
  • Adds toggle to organization general settings page alongside other controls
  • Updates tRPC schema and handler to support disableAutofillOnBookingPage field
  • Modifies useShouldBeDisabledDueToPrefill hook to check organization setting (takes precedence over individual field settings)
  • Includes database migration for new boolean field
  • Adds translation keys for the new setting

Requested by: @anikdhabal
Link to Devin run: https://app.devin.ai/sessions/e731ccf060fe4a18aa64ab1a7c609bc6

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?

Environment Setup:

  • Standard Cal.com development environment
  • Organization with admin privileges

Test Scenarios:

  1. Organization Setting Toggle:

    • Navigate to Organization Settings → General
    • Verify "Disable autofill on booking pages" toggle appears
    • Toggle the setting and verify it saves successfully
  2. Autofill Behavior:

    • With org setting disabled: Individual field disableOnPrefill settings should work as before
    • With org setting enabled: ALL booking form fields should ignore prefill data regardless of individual field settings
    • Test with URL parameters like ?name=John&email=john@example.com
  3. Cross-Organization Verification:

    • Verify setting only affects the specific organization
    • Test booking pages outside the organization are unaffected

Checklist for Reviewers

⚠️ High Priority Review Areas:

  • tRPC Hook Usage: Review the try-catch wrapper around trpc.viewer.organizations.listCurrent.useQuery() in useShouldBeDisabledDueToPrefill.tsx - this pattern is unusual and could cause issues in test environments
  • Behavior Precedence: Verify that organization-level setting correctly overrides individual field disableOnPrefill settings
  • Database Migration: Ensure the migration for disableAutofillOnBookingPage field works correctly

Standard Review Areas:

  • UI integration follows existing patterns and styling
  • Translation keys are properly added and descriptive
  • tRPC schema and handler changes are consistent with existing patterns
  • No breaking changes to existing autofill functionality when org setting is disabled

Notes

  • The organization-level setting takes precedence over individual field disableOnPrefill settings when enabled
  • Implementation follows the same pattern as other organization switches (DisablePhoneOnlySMSNotificationsSwitch, LockEventTypeSwitch, etc.)
  • Database field defaults to false to maintain backward compatibility

devin-ai-integration bot and others added 2 commits September 2, 2025 07:35
- Create DisableAutofillOnBookingPageSwitch component following existing patterns
- Add toggle to organization general page alongside other settings
- Update tRPC organizations update handler to support new field
- Add organization-level check to useShouldBeDisabledDueToPrefill hook
- Add translation keys for new autofill disable setting
- Include database migration for disableAutofillOnBookingPage field
- Maintain backward compatibility with individual field settings

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
- Add disableAutofillOnBookingPage to orgSettings type definition
- Update Prisma schema with new organization setting field
- Clean up test file formatting

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor

coderabbitai bot commented Sep 2, 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.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1756796430-org-disable-autofill

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.
    • 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.
  • 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 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/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only ❗️ migrations contains migration files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to disable autofill on booking page
2 participants