fix: resolve credential mismatch in round robin reschedule causing 404 errors (#22993)

* fix: flaky e2e

* fix: resolve credential mismatch

* test: add comprehensive credential mismatch test for round robin reschedule

- Verify original host credentials used for deletion operations
- Verify new host credentials used for creation operations
- Test dual EventManager pattern implementation
- Fix timeFormat property access issue

Co-Authored-By: [email protected] <[email protected]>

* Update handleNewBooking.ts

* Update booking.ts

* Update handleNewBooking.ts

* update

* Update booking.ts

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-08-11 21:08:40 +05:30
1 parent 7b7478c0a9
commit c20e723e34
4 files changed
+184 -24

No files matched your search

+2 -9
View File
@@ -635,7 +635,7 @@ export default class EventManager {
const shouldUpdateBookingReferences =
!!changedOrganizer || isLocationChanged || !!isBookingRequestedReschedule || isDailyVideoRoomExpired;
if (evt.requiresConfirmation) {
if (evt.requiresConfirmation && !changedOrganizer) {
log.debug("RescheduleRequiresConfirmation: Deleting Event and Meeting for previous booking");
// As the reschedule requires confirmation, we can't update the events and meetings to new time yet. So, just delete them and let it be handled when organizer confirms the booking.
await this.deleteEventsAndMeetings({
@@ -644,14 +644,7 @@ export default class EventManager {
});
} else {
if (changedOrganizer) {
log.debug("RescheduleOrganizerChanged: Deleting Event and Meeting for previous booking");
await this.deleteEventsAndMeetings({
event: { ...event, destinationCalendar: previousHostDestinationCalendar },
bookingReferences: booking.references,
});
log.debug("RescheduleOrganizerChanged: Creating Event and Meeting for for new booking");
const createdEvent = await this.create(originalEvt);
results.push(...createdEvent.results);
updatedBookingReferences.push(...createdEvent.referencesToCreate);
@@ -728,7 +721,7 @@ export default class EventManager {
});
}
private async deleteEventsAndMeetings({
public async deleteEventsAndMeetings({
event,
bookingReferences,
isBookingInRecurringSeries,
+4 -14
View File
@@ -7,6 +7,7 @@ import { bookingMinimalSelect } from "@calcom/prisma";
import type { Booking } from "@calcom/prisma/client";
import { RRTimestampBasis } from "@calcom/prisma/enums";
import { BookingStatus } from "@calcom/prisma/enums";
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
import { UserRepository } from "./user";
@@ -669,25 +670,14 @@ export class BookingRepository {
select: {
id: true,
name: true,
username: true,
email: true,
locale: true,
timeZone: true,
timeFormat: true,
destinationCalendar: true,
credentials: {
select: {
id: true,
userId: true,
key: true,
type: true,
teamId: true,
appId: true,
invalid: true,
user: {
select: {
email: true,
},
},
},
select: credentialForCalendarServiceSelect,
},
},
},