Skip to content

Commit

Permalink
Merge branch 'main' into 12990-cal-2854-add-todesktop-tailwind-variants
Browse files Browse the repository at this point in the history
  • Loading branch information
PeerRich authored Jan 3, 2024
2 parents 6155182 + 6dec981 commit 6f852b6
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Pull Request Labeler"
on:
- pull_request_target
- workflow_call
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -25,7 +26,7 @@ jobs:
- uses: actions/checkout@v2
- uses: equitybee/team-label-action@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token: ${{ secrets.EQUITY_BEE_TEAM_LABELER_ACTION_TOKEN }}
organization-name: calcom
ignore-labels: "app-store, ai, authentication, automated-testing, platform, billing, bookings, caldav, calendar-apps, ci, console, crm-apps, docs, documentation, emails, embeds, event-types, i18n, impersonation, manual-testing, ui, performance, ops-stack, organizations, public-api, routing-forms, seats, teams, webhooks, workflows, zapier"
apply-labels-from-issue:
Expand Down
12 changes: 6 additions & 6 deletions apps/web/pages/api/recorded-daily-video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ const schema = z
id: z.string(),
payload: z.object({
recording_id: z.string(),
end_ts: z.number(),
end_ts: z.number().optional(),
room_name: z.string(),
start_ts: z.number(),
start_ts: z.number().optional(),
status: z.string(),

max_participants: z.number(),
duration: z.number(),
s3_key: z.string(),
max_participants: z.number().optional(),
duration: z.number().optional(),
s3_key: z.string().optional(),
}),
event_ts: z.number(),
event_ts: z.number().optional(),
})
.passthrough();

Expand Down
28 changes: 28 additions & 0 deletions apps/web/playwright/booking/recurringBooking.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable playwright/no-conditional-in-test */
import { loginUser } from "../fixtures/regularBookings";
import { test } from "../lib/fixtures";

test.describe.configure({ mode: "serial" });

test.describe("Booking with recurring checked", () => {
test.beforeEach(async ({ page, users, bookingPage }) => {
await loginUser(users);
await page.goto("/event-types");
await bookingPage.goToEventType("30 min");
await bookingPage.goToTab("recurring");
});

test("Updates event type with recurring events", async ({ page, bookingPage }) => {
await bookingPage.updateRecurringTab("2", "3");
await bookingPage.updateEventType();
await page.getByRole("link", { name: "Event Types" }).click();
await bookingPage.assertRepeatEventType();
});

test("Updates and shows recurring schedule correctly in booking page", async ({ bookingPage }) => {
await bookingPage.updateRecurringTab("2", "3");
await bookingPage.updateEventType();
const eventTypePage = await bookingPage.previewEventType();
await bookingPage.fillRecurringFieldAndConfirm(eventTypePage);
});
});
30 changes: 30 additions & 0 deletions apps/web/playwright/fixtures/regularBookings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect, type Page } from "@playwright/test";

import dayjs from "@calcom/dayjs";

import { localize } from "../lib/testUtils";
import type { createUsersFixture } from "./users";

const reschedulePlaceholderText = "Let others know why you need to reschedule";
Expand Down Expand Up @@ -220,6 +221,23 @@ export function createBookingPageFixture(page: Page) {
}
await page.getByTestId("field-add-save").click();
},
updateRecurringTab: async (repeatWeek: string, maxEvents: string) => {
const repeatText = (await localize("en"))("repeats_every");
const maximumOf = (await localize("en"))("for_a_maximum_of");
await page.getByTestId("recurring-event-check").click();
await page
.getByTestId("recurring-event-collapsible")
.locator("div")
.filter({ hasText: repeatText })
.getByRole("spinbutton")
.fill(repeatWeek);
await page
.getByTestId("recurring-event-collapsible")
.locator("div")
.filter({ hasText: maximumOf })
.getByRole("spinbutton")
.fill(maxEvents);
},
updateEventType: async () => {
await page.getByTestId("update-eventtype").click();
},
Expand All @@ -246,6 +264,14 @@ export function createBookingPageFixture(page: Page) {
await page.getByTestId("confirm-reschedule-button").click();
},

fillRecurringFieldAndConfirm: async (eventTypePage: Page) => {
await eventTypePage.getByTestId("occurrence-input").click();
await eventTypePage.getByTestId("occurrence-input").fill("2");
await goToNextMonthIfNoAvailabilities(eventTypePage);
await eventTypePage.getByTestId("time").first().click();
await expect(eventTypePage.getByTestId("recurring-dates")).toBeVisible();
},

cancelBookingWithReason: async (page: Page) => {
await page.getByTestId("cancel").click();
await page.getByTestId("cancel_reason").fill("Test cancel");
Expand Down Expand Up @@ -279,6 +305,10 @@ export function createBookingPageFixture(page: Page) {
await expect(page.getByText(scheduleSuccessfullyText)).toBeVisible();
},

assertRepeatEventType: async () => {
await expect(page.getByTestId("repeat-eventtype")).toBeVisible();
},

cancelBooking: async (eventTypePage: Page) => {
await eventTypePage.getByTestId("cancel").click();
await eventTypePage.getByTestId("cancel_reason").fill("Test cancel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const EventOccurences = ({ event }: { event: PublicEvent }) => {
i18n.language
);
return (
<>
<div data-testid="recurring-dates">
{recurringStrings.slice(0, 5).map((timeFormatted, key) => (
<p key={key}>{timeFormatted}</p>
))}
Expand All @@ -59,7 +59,7 @@ export const EventOccurences = ({ event }: { event: PublicEvent }) => {
<p className=" text-sm">+ {t("plus_more", { count: recurringStrings.length - 5 })}</p>
</Tooltip>
)}
</>
</div>
);
}

Expand All @@ -73,6 +73,7 @@ export const EventOccurences = ({ event }: { event: PublicEvent }) => {
min="1"
max={event.recurringEvent.count}
defaultValue={occurenceCount || event.recurringEvent.count}
data-testid="occurrence-input"
onChange={(event) => {
const pattern = /^(?=.*[0-9])\S+$/;
const inputValue = parseInt(event.target.value);
Expand Down
17 changes: 13 additions & 4 deletions packages/features/bookings/lib/handleConfirmation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import getWebhooks from "@calcom/features/webhooks/lib/getWebhooks";
import { scheduleTrigger } from "@calcom/features/webhooks/lib/scheduleTrigger";
import type { EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload";
import sendPayload from "@calcom/features/webhooks/lib/sendPayload";
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
import { getTeamIdFromEventType } from "@calcom/lib/getTeamIdFromEventType";
import logger from "@calcom/lib/logger";
import { safeStringify } from "@calcom/lib/safeStringify";
Expand Down Expand Up @@ -138,6 +139,7 @@ export async function handleConfirmation(args: {
}[] = [];

const videoCallUrl = metadata.hangoutLink ? metadata.hangoutLink : evt.videoCallData?.url || "";
const meetingUrl = getVideoCallUrlFromCalEvent(evt) || videoCallUrl;

if (recurringEventId) {
// The booking to confirm is a recurring event and comes from /booking/recurring, proceeding to mark all related
Expand All @@ -162,7 +164,7 @@ export async function handleConfirmation(args: {
paid,
metadata: {
...(typeof recurringBooking.metadata === "object" ? recurringBooking.metadata : {}),
videoCallUrl,
videoCallUrl: meetingUrl,
},
},
select: {
Expand Down Expand Up @@ -215,7 +217,10 @@ export async function handleConfirmation(args: {
references: {
create: scheduleResult.referencesToCreate,
},
metadata: { ...(typeof booking.metadata === "object" ? booking.metadata : {}), videoCallUrl },
metadata: {
...(typeof booking.metadata === "object" ? booking.metadata : {}),
videoCallUrl: meetingUrl,
},
},
select: {
eventType: {
Expand Down Expand Up @@ -258,7 +263,11 @@ export async function handleConfirmation(args: {
try {
for (let index = 0; index < updatedBookings.length; index++) {
const eventTypeSlug = updatedBookings[index].eventType?.slug || "";
const evtOfBooking = { ...evt, metadata: { videoCallUrl }, eventType: { slug: eventTypeSlug } };
const evtOfBooking = {
...evt,
metadata: { videoCallUrl: meetingUrl },
eventType: { slug: eventTypeSlug },
};
evtOfBooking.startTime = updatedBookings[index].startTime.toISOString();
evtOfBooking.endTime = updatedBookings[index].endTime.toISOString();
evtOfBooking.uid = updatedBookings[index].uid;
Expand Down Expand Up @@ -341,7 +350,7 @@ export async function handleConfirmation(args: {
eventTypeId: booking.eventType?.id,
status: "ACCEPTED",
smsReminderNumber: booking.smsReminderNumber || undefined,
metadata: evt.videoCallData?.url ? { videoCallUrl: evt.videoCallData.url } : undefined,
metadata: meetingUrl ? { videoCallUrl: meetingUrl } : undefined,
}).catch((e) => {
console.error(
`Error executing webhook for event: ${WebhookTriggerEvents.BOOKING_CREATED}, URL: ${sub.subscriberUrl}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const EventTypeDescription = ({
</Badge>
)}
{recurringEvent?.count && recurringEvent.count > 0 && (
<li className="hidden xl:block">
<li className="hidden xl:block" data-testid="repeat-eventtype">
<Badge variant="gray" startIcon={RefreshCw}>
{t("repeats_up_to", {
count: recurringEvent.count,
Expand Down

0 comments on commit 6f852b6

Please sign in to comment.