fix: DelegationCredential - Duplicate GoogleMeet and unnecessary serviceAccount key access (#21269)

* Remove unused return statement

* Fix return from fn instead of continuing the loop

* Ensure userId is set for existing records on update

* ensure that serviceAccountKey is only retrieved whenb assked
This commit is contained in:
Hariom Balhara authored and GitHub committed 2025-05-14 09:49:47 +00:00
1 parent deb55c0536
commit df75df7008
32 files changed
+196 -113

No files matched your search

+2 -2
View File
@@ -10,7 +10,7 @@ import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/crede
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { enrichUserWithDelegationCredentialsWithoutOrgId } from "../delegationCredential/server";
import { enrichUserWithDelegationCredentials } from "../delegationCredential/server";
import { getBookerBaseUrl } from "../getBookerUrl/server";
async function getEventType(id: number) {
@@ -109,7 +109,7 @@ export async function getBooking(bookingId: number) {
const { user: userWithoutDelegationCredentials } = booking;
if (!userWithoutDelegationCredentials) throw new HttpCode({ statusCode: 204, message: "No user found" });
const user = await enrichUserWithDelegationCredentialsWithoutOrgId({
const user = await enrichUserWithDelegationCredentials({
user: userWithoutDelegationCredentials,
});
+2 -2
View File
@@ -2,7 +2,7 @@ import type { Prisma } from "@prisma/client";
import { sendScheduledEmailsAndSMS } from "@calcom/emails";
import { doesBookingRequireConfirmation } from "@calcom/features/bookings/lib/doesBookingRequireConfirmation";
import { getAllCredentials } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
import { handleBookingRequested } from "@calcom/features/bookings/lib/handleBookingRequested";
import { handleConfirmation } from "@calcom/features/bookings/lib/handleConfirmation";
import EventManager from "@calcom/lib/EventManager";
@@ -27,7 +27,7 @@ export async function handlePaymentSuccess(paymentId: number, bookingId: number)
status: BookingStatus.ACCEPTED,
};
const allCredentials = await getAllCredentials(userWithCredentials, {
const allCredentials = await getAllCredentialsIncludeServiceAccountKey(userWithCredentials, {
...booking.eventType,
metadata: booking.eventType?.metadata as EventTypeMetadata,
});