Skip to content

Comments

feat: replace BookingReport model with Watchlist system#24039

Closed
eunjae-lee wants to merge 3 commits intomainfrom
devin/replace-booking-report-with-watchlist-1758708093
Closed

feat: replace BookingReport model with Watchlist system#24039
eunjae-lee wants to merge 3 commits intomainfrom
devin/replace-booking-report-with-watchlist-1758708093

Conversation

@eunjae-lee
Copy link
Contributor

What does this PR do?

This PR replaces the BookingReport model introduced in PR #22709 with the existing Watchlist system from PR #23996. The original BookingReport model is removed and replaced with a hybrid approach using:

  • Watchlist entries with type BOOKING_REPORT for the spam prevention system
  • New BookingReportLog model for booking-specific metadata and constraints

Key changes:

  • ✨ Extends WatchlistType enum with BOOKING_REPORT
  • 🗃️ Replaces BookingReport model with BookingReportLog + Watchlist integration
  • 🔧 Updates WatchlistRepository with booking report methods
  • 🎨 Adds report functionality to booking list UI with badges and dialogs
  • 📋 Maintains all existing access control and recurring booking logic
  • 🧪 Includes comprehensive test coverage

This creates a stacked PR on top of #22709, integrating the booking report feature with the existing spam prevention infrastructure.

Visual Demo

The UI now shows:

  • Report buttons in booking actions (three-dots menu or individual button based on booking state)
  • Red "reported" badges showing the report reason
  • Report dialog with reason selection and optional booking cancellation

Mandatory Tasks

  • I have self-reviewed the code
  • N/A - No documentation changes required (internal model refactoring)
  • I confirm automated tests are in place that prove my fix is effective

How should this be tested?

Prerequisites:

  • Set up Cal.com development environment
  • Ensure database migrations are applied
  • Have test bookings in different states (upcoming, past, recurring, team bookings)

Test scenarios:

  1. Basic reporting flow:

    • Navigate to bookings page
    • Click report button on a booking
    • Select report reason and submit
    • Verify red "reported" badge appears
  2. Access control:

    • Test reporting as booking owner, attendee, team admin, and unauthorized user
    • Verify appropriate permissions are enforced
  3. Recurring bookings:

    • Report a recurring booking instance
    • Verify all remaining instances in the series are reported
  4. Cancellation with report:

    • Report an upcoming booking with "cancel booking" checked
    • Verify booking is both reported and cancelled
  5. Team bookings:

    • Test reporting team bookings as team admin/owner
    • Verify team member access patterns work correctly

Checklist

⚠️ Critical areas for review:

  • Access control logic in reportBooking.handler.ts - Complex team membership and attendee verification
  • Recurring booking handling - Reports all remaining instances from selected point onward
  • Database migration safety - Transition from BookingReport to Watchlist + BookingReportLog
  • UI integration - Report buttons, badges, and dialog placement across different booking states
  • Team membership access patterns - Logic for admin/owner access to team member bookings

Requested by: @eunjae-lee
Devin session: https://app.devin.ai/sessions/186d8cd5387246c5af82a6c4b3efb475
Stacks on: #22709 (feat: add report bookings feature)
Related: #23996 (feat: Add spam block schema and migration)

- Add BOOKING_REPORT type to WatchlistType enum
- Create BookingReportLog model for booking-specific metadata
- Update WatchlistRepository with booking report methods
- Migrate tRPC handlers to use Watchlist system
- Update UI components to work with new data structure
- Maintain all existing functionality while using Watchlist backend

Stacks on: #22709

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@devin-ai-integration
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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 24, 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/replace-booking-report-with-watchlist-1758708093

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 the ❗️ migrations contains migration files label Sep 24, 2025
@keithwillcode keithwillcode added consumer core area: core, team members only labels Sep 24, 2025
- Add missing user property to booking object in test
- Add required BookingItemProps properties (listingStatus, recurringInfo, isToday)
- Restructure test data to match expected BookingItemProps interface
- All type checks and unit tests now pass locally

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@vercel
Copy link

vercel bot commented Sep 24, 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 Sep 24, 2025 11:57am
cal-eu Ignored Ignored Sep 24, 2025 11:57am

- Update zod-utils.ts to include fromReport in bookingCancelSchema
- Update handleCancelBooking.ts to support fromReport property
- Resolve CI TypeScript compilation error for booking cancellation input

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consumer core area: core, team members only ❗️ migrations contains migration files size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants