Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/api/v1/pages/api/bookings/[id]/_delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ async function handler(req: NextApiRequest) {
return await handleCancelBooking({
bookingData: { id, allRemainingBookings, cancellationReason, cancelledBy },
userId: req.userId,
impersonatedByUserUuid: null,
actionSource: "API_V1",
});
}
Expand Down
1 change: 1 addition & 0 deletions apps/api/v1/pages/api/bookings/_post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ async function handler(req: NextApiRequest) {
userId,
hostname: req.headers.host || "",
forcedSlug: req.headers["x-cal-force-slug"] as string | undefined,
impersonatedByUserUuid: null,
},
bookingDataSchemaGetter: getBookingDataSchemaForApi,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export class BookingsController_2024_04_15 {
platformBookingUrl: bookingRequest.platformBookingUrl,
platformBookingLocation: bookingRequest.platformBookingLocation,
areCalendarEventsEnabled: bookingRequest.areCalendarEventsEnabled,
impersonatedByUserUuid: null,
},
});
if (booking.userId && booking.uid && booking.startTime && booking.user?.isPlatformManaged) {
Expand Down Expand Up @@ -279,6 +280,7 @@ export class BookingsController_2024_04_15 {
platformCancelUrl: bookingRequest.platformCancelUrl,
platformRescheduleUrl: bookingRequest.platformRescheduleUrl,
platformBookingUrl: bookingRequest.platformBookingUrl,
impersonatedByUserUuid: null,
actionSource: "API_V2",
});
if (!res.onlyRemovedAttendee && res.isPlatformManagedUserBooking) {
Expand Down Expand Up @@ -317,6 +319,7 @@ export class BookingsController_2024_04_15 {
userId: user.id,
actor: makeUserActor(user.uuid),
actionSource: "API_V2",
impersonatedByUserUuid: null,
});

return { status: SUCCESS_STATUS, data: markNoShowResponse };
Expand Down Expand Up @@ -354,6 +357,7 @@ export class BookingsController_2024_04_15 {
platformBookingUrl: bookingRequest.platformBookingUrl,
platformBookingLocation: bookingRequest.platformBookingLocation,
noEmail: bookingRequest.body.noEmail,
impersonatedByUserUuid: null,
},
creationSource: "API_V2",
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class BookingGuestsService_2024_08_13 {
input: { bookingId: booking.id, guests: input.guests },
emailsEnabled,
actionSource: "API_V2",
impersonatedByUserUuid: null,
});
if (res.message === "Guests added") {
return await this.bookingsService.getBooking(bookingUid, user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export class BookingsService_2024_08_13 {
platformBookingLocation: bookingRequest.platformBookingLocation,
noEmail: bookingRequest.noEmail,
areCalendarEventsEnabled: bookingRequest.areCalendarEventsEnabled,
impersonatedByUserUuid: null,
},
creationSource: "API_V2",
});
Expand Down Expand Up @@ -497,6 +498,7 @@ export class BookingsService_2024_08_13 {
platformBookingUrl: bookingRequest.platformBookingUrl,
platformBookingLocation: bookingRequest.platformBookingLocation,
areCalendarEventsEnabled: bookingRequest.areCalendarEventsEnabled,
impersonatedByUserUuid: null,
},
creationSource: "API_V2",
});
Expand Down Expand Up @@ -527,6 +529,7 @@ export class BookingsService_2024_08_13 {
platformBookingUrl: bookingRequest.platformBookingUrl,
platformBookingLocation: bookingRequest.platformBookingLocation,
areCalendarEventsEnabled: bookingRequest.areCalendarEventsEnabled,
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -569,6 +572,7 @@ export class BookingsService_2024_08_13 {
platformBookingUrl: bookingRequest.platformBookingUrl,
platformBookingLocation: bookingRequest.platformBookingLocation,
areCalendarEventsEnabled: bookingRequest.areCalendarEventsEnabled,
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -828,6 +832,7 @@ export class BookingsService_2024_08_13 {
platformBookingUrl: bookingRequest.platformBookingUrl,
platformBookingLocation: bookingRequest.platformBookingLocation,
areCalendarEventsEnabled: bookingRequest.areCalendarEventsEnabled,
impersonatedByUserUuid: null,
},
});
if (!booking.uid) {
Expand Down Expand Up @@ -976,6 +981,7 @@ export class BookingsService_2024_08_13 {
platformCancelUrl: bookingRequest.platformCancelUrl,
platformRescheduleUrl: bookingRequest.platformRescheduleUrl,
platformBookingUrl: bookingRequest.platformBookingUrl,
impersonatedByUserUuid: null,
});

if (!res.onlyRemovedAttendee && res.isPlatformManagedUserBooking) {
Expand Down Expand Up @@ -1036,6 +1042,7 @@ export class BookingsService_2024_08_13 {
platformClientParams,
actor: makeUserActor(userUuid),
actionSource: "API_V2",
impersonatedByUserUuid: null,
});

const booking = await this.bookingsRepository.getByUidWithAttendeesAndUserAndEvent(bookingUid);
Expand Down Expand Up @@ -1242,6 +1249,7 @@ export class BookingsService_2024_08_13 {
platformClientParams,
actionSource: "API_V2",
actor: makeUserActor(requestUser.uuid),
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -1277,6 +1285,7 @@ export class BookingsService_2024_08_13 {
platformClientParams,
actionSource: "API_V2",
actor: makeUserActor(requestUser.uuid),
impersonatedByUserUuid: null,
},
});

Expand Down
1 change: 1 addition & 0 deletions apps/web/app/api/cancel/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function handler(req: NextRequest) {
userId: session?.user?.id || -1,
userUuid: session?.user?.uuid,
actionSource: "WEBAPP",
impersonatedByUserUuid: session?.user?.impersonatedBy?.uuid ?? null,
});

// const bookingCancelService = getBookingCancelService();
Expand Down
1 change: 1 addition & 0 deletions apps/web/app/api/link/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ async function handler(request: NextRequest) {
: undefined,
actionSource: "MAGIC_LINK",
actor: makeUserActor(user.uuid),
impersonatedByUserUuid: null,
},
});
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions apps/web/app/api/verify-booking-token/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async function handleBookingAction(
emailsEnabled: true,
actionSource: "MAGIC_LINK",
actor: makeUserActor(user.uuid),
impersonatedByUserUuid: null,
},
});
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/pages/api/book/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function handler(req: NextApiRequest & { userId?: number; traceContext: Tr
hostname: req.headers.host || "",
forcedSlug: req.headers["x-cal-force-slug"] as string | undefined,
traceContext: req.traceContext,
impersonatedByUserUuid: session?.user?.impersonatedBy?.uuid,
impersonatedByUserUuid: session?.user?.impersonatedBy?.uuid ?? null,
},
});

Expand Down
1 change: 1 addition & 0 deletions apps/web/pages/api/book/recurring-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async function handler(req: NextApiRequest & RequestMeta) {
platformRescheduleUrl: req.platformRescheduleUrl,
platformBookingLocation: req.platformBookingLocation,
noEmail: req.noEmail,
impersonatedByUserUuid: session?.user?.impersonatedBy?.uuid ?? null,
},
creationSource: "WEBAPP",
});
Expand Down
4 changes: 2 additions & 2 deletions apps/web/playwright/locale.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ test.describe("authorized user sees changed translations (de->ar)", async () =>
await test.step("should change the language and show Arabic translations", async () => {
await page.goto("/settings/my-account/general");

await page.waitForLoadState("domcontentloaded");
await page.waitForLoadState("networkidle");

await page.getByTestId("locale-select").click();
await page.getByTestId("select-option-ar").click();
Expand Down Expand Up @@ -462,7 +462,7 @@ test.describe("authorized user sees changed translations (de->pt-BR) [locale1]",

await test.step("should change the language and show Brazil-Portuguese translations", async () => {
await page.goto("/settings/my-account/general");
await page.waitForLoadState("domcontentloaded");
await page.waitForLoadState("networkidle");

await page.getByTestId("locale-select").click();
await page.getByTestId("select-option-pt-BR").click();
Expand Down
1 change: 1 addition & 0 deletions apps/web/test/handlers/requestReschedule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,5 +580,6 @@ function getTrpcHandlerData({
},
input: input,
source: "WEBAPP" as const,
impersonatedByUserUuid: null,
};
}
5 changes: 5 additions & 0 deletions apps/web/test/lib/confirm.handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ describe("confirmHandler", () => {
emailsEnabled: true,
actor: makeUserActor(ctx.user.uuid),
actionSource: "WEBAPP",
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -230,6 +231,7 @@ describe("confirmHandler", () => {
emailsEnabled: true,
actor,
actionSource: "WEBAPP",
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -357,6 +359,7 @@ describe("confirmHandler", () => {
emailsEnabled: true,
actor,
actionSource: "WEBAPP",
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -467,6 +470,7 @@ describe("confirmHandler", () => {
emailsEnabled: false,
actor,
actionSource: "WEBAPP",
impersonatedByUserUuid: null,
},
});

Expand Down Expand Up @@ -592,6 +596,7 @@ describe("confirmHandler", () => {
emailsEnabled: false,
actor,
actionSource: "WEBAPP",
impersonatedByUserUuid: null,
},
});

Expand Down
1 change: 1 addition & 0 deletions packages/app-store/_utils/payments/handlePaymentSuccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export async function handlePaymentSuccess(params: {
platformClientParams,
traceContext: updatedTraceContext,
actionSource: "WEBHOOK",
impersonatedByUserUuid: null,
actor,
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export interface BookingAuditProducerService {
organizationId: number | null;
source: ActionSource;
operationId?: string | null;
context?: BookingAuditContext;
isBookingAuditEnabled: boolean;
}): Promise<void>;

Expand All @@ -220,6 +221,7 @@ export interface BookingAuditProducerService {
organizationId: number | null;
source: ActionSource;
operationId?: string | null;
context?: BookingAuditContext;
isBookingAuditEnabled: boolean;
}): Promise<void>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ export class BookingAuditTaskerProducerService implements BookingAuditProducerSe
organizationId: number | null;
source: ActionSource;
operationId?: string | null;
context?: BookingAuditContext;
isBookingAuditEnabled: boolean;
}): Promise<void> {
await this.queueBulkTask({
Expand All @@ -455,6 +456,7 @@ export class BookingAuditTaskerProducerService implements BookingAuditProducerSe
organizationId: number | null;
source: ActionSource;
operationId?: string | null;
context?: BookingAuditContext;
isBookingAuditEnabled: boolean;
}): Promise<void> {
await this.queueBulkTask({
Expand Down
1 change: 1 addition & 0 deletions packages/features/bookings/lib/dto/BookingCancel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type CancelBookingMeta = {
platformCancelUrl?: string;
platformBookingUrl?: string;
arePlatformEmailsEnabled?: boolean;
impersonatedByUserUuid: string | null;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/features/bookings/lib/dto/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type CreateBookingMeta = {
forcedSlug?: string;
noEmail?: boolean;
traceContext?: TraceContext;
impersonatedByUserUuid?: string;
impersonatedByUserUuid: string | null;
} & PlatformParams;

export type BookingHandlerInput = {
Expand Down
7 changes: 7 additions & 0 deletions packages/features/bookings/lib/handleCancelBooking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export type CancelBookingInput = {
userUuid?: string;
bookingData: z.infer<typeof bookingCancelInput>;
actionSource: ValidActionSource;
impersonatedByUserUuid: string | null;
} & PlatformParams;

type Dependencies = {
Expand Down Expand Up @@ -179,6 +180,9 @@ async function handler(input: CancelBookingInput, dependencies?: Dependencies) {
} = input;

const userUuid = input.userUuid ?? null;
const impersonatedByUserUuid = input.impersonatedByUserUuid ?? null;

const auditContext = impersonatedByUserUuid ? { impersonatedBy: impersonatedByUserUuid } : undefined;

const actionSource = input.actionSource;

Expand Down Expand Up @@ -557,6 +561,7 @@ async function handler(input: CancelBookingInput, dependencies?: Dependencies) {
organizationId: orgId ?? null,
operationId,
source: actionSource,
context: auditContext,
isBookingAuditEnabled,
});
} else {
Expand Down Expand Up @@ -592,6 +597,7 @@ async function handler(input: CancelBookingInput, dependencies?: Dependencies) {
new: BookingStatus.CANCELLED,
},
},
context: auditContext,
isBookingAuditEnabled,
});

Expand Down Expand Up @@ -756,6 +762,7 @@ export class BookingCancelService implements IBookingCancelService {
const cancelBookingInput: CancelBookingInput = {
bookingData: input.bookingData,
...(input.bookingMeta || {}),
impersonatedByUserUuid: input.bookingMeta?.impersonatedByUserUuid ?? null,
actionSource: input.actionSource,
};

Expand Down
Loading
Loading