Merge branch 'feature/reschedule-bookings' of ssh://github.com/calcom/cal.com into feature/app-wipe-my-cal
This commit is contained in:
commit
4fe25ef05c
|
@ -1,7 +1,7 @@
|
|||
import { UserIcon } from "@heroicons/react/outline";
|
||||
import { InformationCircleIcon } from "@heroicons/react/solid";
|
||||
import { MembershipRole } from "@prisma/client";
|
||||
import React, { useState, useEffect, SyntheticEvent } from "react";
|
||||
import React, { useState, useEffect, SyntheticEvent, useMemo } from "react";
|
||||
|
||||
import Button from "@calcom/ui/Button";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog";
|
||||
|
@ -24,19 +24,19 @@ type MembershipRoleOption = {
|
|||
label?: string;
|
||||
};
|
||||
|
||||
const options: MembershipRoleOption[] = [{ value: "MEMBER" }, { value: "ADMIN" }];
|
||||
const _options: MembershipRoleOption[] = [{ value: "MEMBER" }, { value: "ADMIN" }];
|
||||
|
||||
export default function MemberInvitationModal(props: MemberInvitationModalProps) {
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
const { t, i18n } = useLocale();
|
||||
const utils = trpc.useContext();
|
||||
|
||||
useEffect(() => {
|
||||
options.forEach((option, i) => {
|
||||
options[i].label = t(option.value.toLowerCase());
|
||||
const options = useMemo(() => {
|
||||
_options.forEach((option, i) => {
|
||||
_options[i].label = t(option.value.toLowerCase());
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
return _options;
|
||||
}, [t]);
|
||||
|
||||
const inviteMemberMutation = trpc.useMutation("viewer.teams.inviteMember", {
|
||||
async onSuccess() {
|
||||
|
@ -99,6 +99,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
|
|||
{t("role")}
|
||||
</label>
|
||||
<Select
|
||||
defaultValue={options[0]}
|
||||
options={options}
|
||||
id="role"
|
||||
name="role"
|
||||
|
|
|
@ -109,6 +109,7 @@ test.describe("pro user", () => {
|
|||
|
||||
await page.goto("/bookings/upcoming");
|
||||
await page.locator('[data-testid="reschedule"]').click();
|
||||
await page.locator('[data-testid="edit"]').click();
|
||||
await page.waitForNavigation({
|
||||
url: (url) => {
|
||||
const bookingId = url.searchParams.get("rescheduleUid");
|
||||
|
|
|
@ -43,6 +43,7 @@ test.describe("dynamic booking", () => {
|
|||
// Logged in
|
||||
await page.goto("/bookings/upcoming");
|
||||
await page.locator('[data-testid="reschedule"]').click();
|
||||
await page.locator('[data-testid="edit"]').click();
|
||||
await page.waitForNavigation({
|
||||
url: (url) => {
|
||||
const bookingId = url.searchParams.get("rescheduleUid");
|
||||
|
|
|
@ -13,6 +13,7 @@ test.describe.serial("Stripe integration", () => {
|
|||
test.afterAll(() => {
|
||||
teardown.deleteAllPaymentsByEmail("pro@example.com");
|
||||
teardown.deleteAllBookingsByEmail("pro@example.com");
|
||||
teardown.deleteAllPaymentCredentialsByEmail("pro@example.com");
|
||||
});
|
||||
test.skip(!IS_STRIPE_ENABLED, "It should only run if Stripe is installed");
|
||||
|
||||
|
@ -69,14 +70,12 @@ test.describe.serial("Stripe integration", () => {
|
|||
// Click button:has-text("Pay now")
|
||||
await page.click('button:has-text("Pay now")');
|
||||
|
||||
// Make sure we're navigated to the paid page
|
||||
// Make sure we're navigated to the success page
|
||||
await page.waitForNavigation({
|
||||
url(url) {
|
||||
return url.pathname.endsWith("/paid");
|
||||
return url.pathname.endsWith("/success");
|
||||
},
|
||||
});
|
||||
|
||||
await expect(page).toHaveURL(/.*payment/);
|
||||
});
|
||||
|
||||
todo("Pending payment booking should not be confirmed by default");
|
||||
|
|
|
@ -44,3 +44,20 @@ export const deleteAllPaymentsByEmail = async (email: string) => {
|
|||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteAllPaymentCredentialsByEmail = async (email: string) => {
|
||||
await prisma.user.update({
|
||||
where: {
|
||||
email,
|
||||
},
|
||||
data: {
|
||||
credentials: {
|
||||
deleteMany: {
|
||||
type: {
|
||||
endsWith: "_payment",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user