fix: filter deleted booking references in EventManager methods #22934
+10
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Filter deleted booking references in EventManager methods
Summary
Fixes an issue where old booking owners still see calendar events on their calendar when a reassigned booking's location is changed. The problem occurred because the EventManager's
updateLocation
anddeleteEventsAndMeetings
methods were processing all booking references without filtering out soft-deleted ones.Root Cause: When a booking is reassigned, the old booking references are soft-deleted (marked with
deleted: true
) but the EventManager methods weren't filtering these out before attempting calendar operations.Solution: Added filtering logic to exclude deleted booking references before processing calendar updates, following the same pattern already established in the
reschedule
method.Review & Testing Checklist for Human
deleted
field toPartialReference
doesn't break other parts of the codebase that use this typereschedule
method and is applied correctly in both modified methodsDiagram
Notes
Key Changes:
activeReferences
filtering inupdateLocation()
anddeleteEventsAndMeetings()
methods to exclude references wheredeleted: true
deleted?: boolean | null
toPartialReference
interface to support the filtering logicTesting Limitations: Due to environment setup issues (ESLint configuration problems), I wasn't able to fully test the end-to-end flow locally. The type checking passed successfully, but comprehensive testing of the booking reassignment + location change scenario is needed.
Link to Devin run: https://app.devin.ai/sessions/b8cc831382df4e8f89ff1c8887bb4da2
Requested by: @joeauyeung