feat: Add consistent iCalUID (#12122)

Co-authored-by: Hariom <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-12-15 10:28:32 -05:00
1 parent 0e8ac7e4ed
commit 9dfa596e3e
33 files changed
+568 -195

No files matched your search

+6 -2
View File
@@ -176,7 +176,11 @@ export const getRescheduleLink = (calEvent: CalendarEvent): string => {
return `${calEvent.bookerUrl ?? WEBAPP_URL}/reschedule/${seatUid ? seatUid : Uid}`;
};
export const getRichDescription = (calEvent: CalendarEvent, t_?: TFunction /*, attendee?: Person*/) => {
export const getRichDescription = (
calEvent: CalendarEvent,
t_?: TFunction /*, attendee?: Person*/,
includeAppStatus = false
) => {
const t = t_ ?? calEvent.organizer.language.translate;
return `
@@ -189,7 +193,7 @@ ${getLocation(calEvent)}
${getDescription(calEvent, t)}
${getAdditionalNotes(calEvent, t)}
${getUserFieldsResponses(calEvent)}
${getAppsStatus(calEvent, t)}
${includeAppStatus ? getAppsStatus(calEvent, t) : ""}
${
// TODO: Only the original attendee can make changes to the event
// Guests cannot
+1
View File
@@ -11,6 +11,7 @@ import { buildCalendarEvent, buildVideoCallData } from "./builder";
vi.mock("@calcom/lib/constants", () => ({
WEBAPP_URL: "http://localhost:3000",
APP_NAME: "Cal.com",
}));
vi.mock("short-uuid", () => ({
+8 -2
View File
@@ -2,6 +2,7 @@ import { faker } from "@faker-js/faker";
import type { Booking, EventType, Prisma, Webhook } from "@prisma/client";
import type { TFunction } from "next-i18next";
import getICalUID from "@calcom/emails/lib/getICalUID";
import { BookingStatus } from "@calcom/prisma/enums";
import type { CalendarEvent, Person, VideoCallData } from "@calcom/types/Calendar";
@@ -31,9 +32,10 @@ export const buildPerson = (person?: Partial<Person>): Person => {
};
export const buildBooking = (booking?: Partial<Booking>): Booking => {
const uid = faker.datatype.uuid();
return {
id: faker.datatype.number(),
uid: faker.datatype.uuid(),
uid,
userId: null,
eventTypeId: null,
title: faker.lorem.sentence(),
@@ -59,6 +61,8 @@ export const buildBooking = (booking?: Partial<Booking>): Booking => {
metadata: null,
responses: null,
isRecorded: false,
iCalUID: getICalUID({ uid }),
iCalSequence: 0,
...booking,
};
};
@@ -155,8 +159,10 @@ export const buildSubscriberEvent = (booking?: Partial<Booking>) => {
};
export const buildCalendarEvent = (event?: Partial<CalendarEvent>): CalendarEvent => {
const uid = faker.datatype.uuid();
return {
uid: faker.datatype.uuid(),
uid,
iCalUID: getICalUID({ uid }),
type: faker.helpers.arrayElement(["event", "meeting"]),
title: faker.lorem.sentence(),
startTime: faker.date.future().toISOString(),