Skip to content

Scheduling infrastructure for absolutely everyone.

feat(troubleshoot): add event titles to the troubleshoot page (#3434) (#3437)

Heiki5358e5848df4
diff --git a/apps/web/pages/availability/troubleshoot.tsx b/apps/web/pages/availability/troubleshoot.tsx
index 74c791ff8aa..f1c1162dad4 100644
--- a/apps/web/pages/availability/troubleshoot.tsx
+++ b/apps/web/pages/availability/troubleshoot.tsx
@@ -14,7 +14,7 @@ type User = inferQueryOutput<"viewer.me">;
const AvailabilityView = ({ user }: { user: User }) => {
const { t } = useLocale();
const [loading, setLoading] = useState(true);
- const [availability, setAvailability] = useState<{ end: string; start: string }[]>([]);
+ const [availability, setAvailability] = useState<{ end: string; start: string; title?: string }[]>([]);
const [selectedDate, setSelectedDate] = useState(dayjs());
function convertMinsToHrsMins(mins: number) {
@@ -83,6 +83,7 @@ const AvailabilityView = ({ user }: { user: User }) => {
</span>{" "}
{t("on")} {dayjs(slot.start).format("D")}{" "}
{t(dayjs(slot.start).format("MMMM").toLowerCase())} {dayjs(slot.start).format("YYYY")}
+ {slot.title && ` - (${slot.title})`}
</div>
</div>
))
diff --git a/packages/core/getBusyTimes.ts b/packages/core/getBusyTimes.ts
index 26d7ec13400..e6131e21753 100644
--- a/packages/core/getBusyTimes.ts
+++ b/packages/core/getBusyTimes.ts
@@ -5,7 +5,7 @@ import logger from "@calcom/lib/logger";
// import { getBusyVideoTimes } from "@calcom/core/videoClient";
// import notEmpty from "@calcom/lib/notEmpty";
import prisma from "@calcom/prisma";
-import type { EventBusyDate } from "@calcom/types/Calendar";
+import type { EventBusyDetails } from "@calcom/types/Calendar";
export async function getBusyTimes(params: {
credentials: Credential[];
@@ -24,7 +24,7 @@ export async function getBusyTimes(params: {
})}`
);
const startPrismaBookingGet = performance.now();
- const busyTimes: EventBusyDate[] = await prisma.booking
+ const busyTimes: EventBusyDetails[] = await prisma.booking
.findMany({
where: {
userId,
@@ -39,9 +39,10 @@ export async function getBusyTimes(params: {
id: true,
startTime: true,
endTime: true,
+ title: true,
},
})
- .then((bookings) => bookings.map(({ startTime, endTime }) => ({ end: endTime, start: startTime })));
+ .then((bookings) => bookings.map(({ startTime, endTime, title }) => ({ end: endTime, start: startTime, title })));
logger.silly(`Busy Time from Cal Bookings ${JSON.stringify(busyTimes)}`);
const endPrismaBookingGet = performance.now();
logger.debug(`prisma booking get took ${endPrismaBookingGet - startPrismaBookingGet}ms`);
diff --git a/packages/core/getUserAvailability.ts b/packages/core/getUserAvailability.ts
index 1565a72f5a7..a398f6c8cdb 100644
--- a/packages/core/getUserAvailability.ts
+++ b/packages/core/getUserAvailability.ts
@@ -132,6 +132,7 @@ export async function getUserAvailability(
end: dayjs(a.end)
.add(currentUser.bufferTime + (afterEventBuffer || 0), "minute")
.toISOString(),
+ title: a.title,
}));
const schedule = eventType?.schedule
diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.ts
index 68bb770d7df..b4b7333eb43 100644
--- a/packages/types/Calendar.d.ts
+++ b/packages/types/Calendar.d.ts
@@ -26,6 +26,10 @@ export type Person = {
export type EventBusyDate = Record<"start" | "end", Date | string>;
+export type EventBusyDetails = EventBusyDate & {
+ title?: string;
+};
+
export type CalendarServiceType = typeof Calendar;
export type NewCalendarEventType = {