Skip to content

Commit 88f435f

Browse files
authored
Merge branch 'main' into fix/new-team-creation
2 parents 5e0d00d + aa0e9e6 commit 88f435f

10 files changed

Lines changed: 44 additions & 19 deletions

File tree

apps/web/components/booking/CancelBooking.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default function CancelBooking(props: Props) {
7777
{t("nevermind")}
7878
</Button>
7979
<Button
80-
className="flex justify-center"
80+
className="dark:bg-darkmodebrand dark:hover:border-darkmodebrand dark:text-darkmodebrandcontrast bg-brand hover:border-brand text-brandcontrast flex justify-center"
8181
data-testid="cancel"
8282
onClick={async () => {
8383
setLoading(true);

apps/web/components/booking/pages/BookingPage.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ const routerQuerySchema = z
205205
const BookingPage = ({
206206
eventType,
207207
booking,
208+
currentSlotBooking,
208209
profile,
209210
isDynamicGroupBooking,
210211
recurringEventCount,
@@ -584,23 +585,27 @@ const BookingPage = ({
584585
<div className="text-bookinghighlight flex items-start text-sm">
585586
<FiUser
586587
className={`ml-[2px] mt-[2px] inline-block h-4 w-4 ltr:mr-[10px] rtl:ml-[10px] ${
587-
booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.5
588+
currentSlotBooking &&
589+
currentSlotBooking.attendees.length / eventType.seatsPerTimeSlot >= 0.5
588590
? "text-rose-600"
589-
: booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.33
591+
: currentSlotBooking &&
592+
currentSlotBooking.attendees.length / eventType.seatsPerTimeSlot >= 0.33
590593
? "text-yellow-500"
591594
: "text-bookinghighlight"
592595
}`}
593596
/>
594597
<p
595598
className={`${
596-
booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.5
599+
currentSlotBooking &&
600+
currentSlotBooking.attendees.length / eventType.seatsPerTimeSlot >= 0.5
597601
? "text-rose-600"
598-
: booking && booking.attendees.length / eventType.seatsPerTimeSlot >= 0.33
602+
: currentSlotBooking &&
603+
currentSlotBooking.attendees.length / eventType.seatsPerTimeSlot >= 0.33
599604
? "text-yellow-500"
600605
: "text-bookinghighlight"
601606
} mb-2 font-medium`}>
602-
{booking
603-
? eventType.seatsPerTimeSlot - booking.attendees.length
607+
{currentSlotBooking
608+
? eventType.seatsPerTimeSlot - currentSlotBooking.attendees.length
604609
: eventType.seatsPerTimeSlot}{" "}
605610
/ {eventType.seatsPerTimeSlot} {t("seats_available")}
606611
</p>
@@ -632,6 +637,7 @@ const BookingPage = ({
632637
</Button>
633638
<Button
634639
type="submit"
640+
className="dark:bg-darkmodebrand dark:hover:border-darkmodebrand dark:text-darkmodebrandcontrast bg-brand hover:border-brand text-brandcontrast"
635641
data-testid={rescheduleUid ? "confirm-reschedule-button" : "confirm-book-button"}
636642
loading={mutation.isLoading || recurringMutation.isLoading}>
637643
{rescheduleUid ? t("reschedule") : t("confirm")}

apps/web/pages/[user]/book.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
217217
rescheduleUid = bookingSeat.booking.uid;
218218
attendeeEmail = bookingSeat.attendee.email;
219219
}
220-
} else if (eventTypeRaw.seatsPerTimeSlot && query.duration && query.date) {
220+
}
221+
222+
if (query.duration) {
221223
// If it's not reschedule but event Type has seats we should obtain
222224
// the bookingUid regardless and use it to get the booking
223225
const currentSeats = await prisma.booking.findFirst({
@@ -281,12 +283,15 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
281283
: eventType.recurringEvent.count)) ||
282284
null;
283285

286+
const currentSlotBooking = await getBooking(prisma, bookingUidWithSeats || "");
287+
284288
return {
285289
props: {
286290
away: user.away,
287291
profile,
288292
eventType: eventTypeObject,
289293
booking,
294+
currentSlotBooking: currentSlotBooking,
290295
recurringEventCount,
291296
trpcState: ssr.dehydrate(),
292297
isDynamicGroupBooking,

apps/web/pages/d/[link]/book.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
120120
profile,
121121
eventType: eventTypeObject,
122122
booking: null,
123+
currentSlotBooking: null,
123124
trpcState: ssr.dehydrate(),
124125
recurringEventCount,
125126
isDynamicGroupBooking: false,

apps/web/pages/team/[slug]/book.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
152152
eventType: eventTypeObject,
153153
recurringEventCount,
154154
booking,
155+
currentSlotBooking: null,
155156
isDynamicGroupBooking: false,
156157
hasHashedBookingLink: false,
157158
hashedLink: null,

apps/web/playwright/event-types.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ test.describe("Event Types tests", () => {
119119
await page.locator("#location-select").click();
120120
await page.locator("text=In Person (Organizer Address)").click();
121121
// eslint-disable-next-line playwright/no-wait-for-timeout
122-
await page.waitForTimeout(250);
122+
await page.waitForTimeout(1000);
123123
await page.locator('input[name="locationAddress"]').fill(inputText);
124124
await page.locator("[data-testid=display-location]").check();
125125
await page.locator("[data-testid=update-location]").click();

apps/web/playwright/onboarding.e2e.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ test.describe("Onboarding", () => {
2626
await page.locator("input[name=username]").fill("new user onboarding");
2727
await page.locator("input[name=name]").fill("new user 2");
2828
await page.locator("input[role=combobox]").click();
29-
await page.locator("text=Europe/London GMT +0:00").click();
29+
await page
30+
.locator("*")
31+
.filter({ hasText: /^Europe\/London/ })
32+
.first()
33+
.click();
3034

3135
await page.locator("button[type=submit]").click();
3236

apps/web/playwright/reschedule.e2e.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ test.describe("Reschedule Tests", async () => {
9797

9898
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
9999

100-
// NOTE: remove if old booking should not be deleted
101-
expect(await (await booking.self()).status).toBe(BookingStatus.CANCELLED);
102-
103100
const newBooking = await prisma.booking.findFirst({ where: { fromReschedule: booking.uid } });
101+
const rescheduledBooking = await prisma.booking.findFirst({ where: { uid: booking.uid } });
102+
104103
expect(newBooking).not.toBeNull();
104+
expect(rescheduledBooking).toBeNull();
105+
105106
await prisma.booking.delete({ where: { id: newBooking?.id } });
106107
});
107108

@@ -148,7 +149,6 @@ test.describe("Reschedule Tests", async () => {
148149
});
149150

150151
await expect(page).toHaveURL(/.*payment/);
151-
await payment.delete();
152152
});
153153

154154
test("Paid rescheduling should go to success page", async ({ page, users, bookings, payments }) => {
@@ -172,8 +172,6 @@ test.describe("Reschedule Tests", async () => {
172172
await page.locator('[data-testid="confirm-reschedule-button"]').click();
173173

174174
await expect(page).toHaveURL(/.*booking/);
175-
176-
await payment.delete();
177175
});
178176

179177
test("Opt in event should be PENDING when rescheduled by USER", async ({ page, users, bookings }) => {

packages/app-store/googlecalendar/lib/CalendarService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export default class GoogleCalendarService implements Calendar {
133133
calendarId: selectedCalendar,
134134
requestBody: payload,
135135
conferenceDataVersion: 1,
136+
sendUpdates: "none",
136137
},
137138
function (error, event) {
138139
if (error || !event?.data) {
@@ -234,14 +235,13 @@ export default class GoogleCalendarService implements Calendar {
234235
calendarId: selectedCalendar,
235236
eventId: uid,
236237
sendNotifications: true,
237-
sendUpdates: "all",
238+
sendUpdates: "none",
238239
requestBody: payload,
239240
conferenceDataVersion: 1,
240241
},
241242
function (err, evt) {
242243
if (err) {
243244
console.error("There was an error contacting google calendar service: ", err);
244-
245245
return reject(err);
246246
}
247247

@@ -293,7 +293,7 @@ export default class GoogleCalendarService implements Calendar {
293293
calendarId: calendarId ? calendarId : defaultCalendarId,
294294
eventId: uid,
295295
sendNotifications: false,
296-
sendUpdates: "all",
296+
sendUpdates: "none",
297297
},
298298
function (err: GoogleCalError | null, event) {
299299
if (err) {

packages/features/bookings/lib/handleNewBooking.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,16 @@ async function handler(
16631663
// Use EventManager to conditionally use all needed integrations.
16641664
addVideoCallDataToEvt(originalRescheduledBooking.references);
16651665
const updateManager = await eventManager.reschedule(evt, originalRescheduledBooking.uid);
1666+
1667+
//delete original rescheduled booking (no seats event)
1668+
if (!eventType.seatsPerTimeSlot) {
1669+
await prisma.booking.delete({
1670+
where: {
1671+
id: originalRescheduledBooking.id,
1672+
},
1673+
});
1674+
}
1675+
16661676
// This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back
16671677
// to the default description when we are sending the emails.
16681678
evt.description = eventType.description;

0 commit comments

Comments
 (0)