Skip to content

Conversation

ossamalafhel
Copy link

  • Add minimum cancellation notice field to event types
  • Implement validation for cancellation requests within minimum notice period
  • Add validation for reschedule requests within minimum notice period
  • Add comprehensive e2e and unit tests for the feature
  • Update UI components to support minimum cancellation notice
  • Add database migration for minimumCancellationNotice field
  • Add documentation for the new feature

What does this PR do?

This PR implements a Minimum Cancellation Notice feature that allows event organizers to set a minimum time period before which attendees cannot cancel or reschedule
bookings.

Key Features:

Visual Demo (For contributors especially)

Image Demo:

1. Event Type Configuration

The new "Minimum cancellation notice" field in the Event Type Limits tab:
![Configuration UI - To be added]

2. Cancellation Blocked

Error message when trying to cancel within the minimum notice period:
![Cancellation Error - To be added]

3. Reschedule Blocked

Error message when trying to reschedule within the minimum notice period:
![Reschedule Error - To be added]

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. Added
    docs/developing/guides/event-types/minimum-cancellation-notice.mdx
  • 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

  • Ensure database is running: yarn dx
  • Apply migrations: yarn db-migrate
  • No additional environment variables required

Test Scenarios

  1. Configure Minimum Notice Period

    • Go to Event Types → Select any event → Limits tab
    • Set "Minimum cancellation notice" to 24 hours
    • Save the event type
  2. Test Cancellation Prevention

    • Book an event happening within 24 hours
    • Try to cancel → Should see error: "Cannot cancel booking within 24 hours of the event"
    • Book an event happening after 24 hours
    • Try to cancel → Should work normally
  3. Test Reschedule Prevention

    • Book an event happening within 24 hours
    • Try to reschedule → Should see error message
    • Book an event happening after 24 hours
    • Try to reschedule → Should work normally

Automated Tests

  • Unit tests: yarn test minimumCancellationNotice
  • E2E tests: yarn playwright test cancellation-validation.e2e.ts

Expected Behavior

  • Input: Set minimum cancellation notice to X hours
  • Output: Users cannot cancel/reschedule bookings less than X hours before the event
  • Error messages: Clear feedback when actions are blocked

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Additional Notes

Testing Challenges

Despite numerous attempts, I was unable to run the e2e tests locally due to extremely slow Next.js compilation times (30-40+ minutes). I've tried various configurations
including:

  • Standard dev server
  • Dev server without Turbopack
  • Production build
  • Full yarn dx environment

The tests consistently timeout. Is there a staging server or alternative testing environment available for contributors?

Implementation Details

  • Database migration adds minimumCancellationNotice field (integer, minutes, default: 0)
  • Validation happens in both handleCancelBooking and requestReschedule handlers
  • UI component uses the existing duration input pattern for consistency
  • Feature is backward compatible - existing event types default to 0 (no restriction)

…ule notice for bookings

- Add minimum cancellation notice field to event types
- Implement validation for cancellation requests within minimum notice period
- Add validation for reschedule requests within minimum notice period
- Add comprehensive e2e and unit tests for the feature
- Update UI components to support minimum cancellation notice
- Add database migration for minimumCancellationNotice field
- Add documentation for the new feature
Copy link

vercel bot commented Sep 15, 2025

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

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added ❗️ migrations contains migration files Medium priority Created by Linear-GitHub Sync Stale ✨ feature New feature or request labels Sep 15, 2025
Copy link
Contributor

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "  feat(minimum-cancellation-notice): add minimum cancellation/reschedule notice for bookings (#15647)". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature New feature or request Medium priority Created by Linear-GitHub Sync ❗️ migrations contains migration files size/XXL Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a field to Cal.com to limit time people can cancel/reschedule a meeting.
2 participants