Fix booking error in case of no calendar credential but stray destinationCalendar (#12680)
This commit is contained in:
parent
325f250d39
commit
f2a59fe4e8
|
@ -574,24 +574,25 @@ export default class EventManager {
|
||||||
(c) => c.type === destination.integration
|
(c) => c.type === destination.integration
|
||||||
);
|
);
|
||||||
// It might not be the first connected calendar as it seems that the order is not guaranteed to be ascending of credentialId.
|
// It might not be the first connected calendar as it seems that the order is not guaranteed to be ascending of credentialId.
|
||||||
const firstCalendarCredential = destinationCalendarCredentials[0];
|
const firstCalendarCredential = destinationCalendarCredentials[0] as
|
||||||
|
| (typeof destinationCalendarCredentials)[number]
|
||||||
|
| undefined;
|
||||||
|
|
||||||
if (!firstCalendarCredential) {
|
if (!firstCalendarCredential) {
|
||||||
log.warn(
|
log.warn(
|
||||||
"No other credentials found of the same type as the destination calendar. Falling back to first connected calendar"
|
"No other credentials found of the same type as the destination calendar. Falling back to first connected calendar"
|
||||||
);
|
);
|
||||||
await fallbackToFirstConnectedCalendar();
|
await fallbackToFirstConnectedCalendar();
|
||||||
|
} else {
|
||||||
|
log.warn(
|
||||||
|
"No credentialId found for destination calendar, falling back to first found calendar of same type as destination calendar",
|
||||||
|
safeStringify({
|
||||||
|
destination: getPiiFreeDestinationCalendar(destination),
|
||||||
|
firstConnectedCalendar: getPiiFreeCredential(firstCalendarCredential),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
createdEvents.push(await createEvent(firstCalendarCredential, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
log.warn(
|
|
||||||
"No credentialId found for destination calendar, falling back to first found calendar",
|
|
||||||
safeStringify({
|
|
||||||
destination: getPiiFreeDestinationCalendar(destination),
|
|
||||||
firstConnectedCalendar: getPiiFreeCredential(firstCalendarCredential),
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
createdEvents.push(await createEvent(firstCalendarCredential, event));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user