Fix/wipe vital app revision (#2983)
* Fixes for both apps regarding event update/delete * Added wipe my cal test * Added eslint ignore * Fix test * Merge both test into a single test * remove duplicated line * Using prisma from calcom pkg and removing optional chaining from current invocations Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
8 files changed
+88
-40
No files matched your search
@@ -139,19 +139,6 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||
logger.error(error.message);
|
||||
}
|
||||
}
|
||||
// Creating cancelled event as placeholders in calendars, remove when virtual calendar handles it
|
||||
try {
|
||||
const eventManager = new EventManager({
|
||||
credentials: userOwner.credentials,
|
||||
destinationCalendar: userOwner.destinationCalendar,
|
||||
});
|
||||
builder.calendarEvent.title = `Cancelled: ${builder.calendarEvent.title}`;
|
||||
await eventManager.updateAndSetCancelledPlaceholder(builder.calendarEvent, bookingToReschedule);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
logger.error(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Send emails
|
||||
try {
|
||||
|
||||
@@ -21,7 +21,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (!req.session?.user?.id) {
|
||||
return res.status(401).json({ message: "You must be logged in to do this" });
|
||||
}
|
||||
let result = false;
|
||||
|
||||
try {
|
||||
const { initialDate, endDate } = req.body;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ const wipeMyCalAction = async (props: IWipeMyCalAction) => {
|
||||
};
|
||||
try {
|
||||
const endpoint = "/api/integrations/wipemycalother/wipe";
|
||||
return fetch(`${process.env.NEXT_PUBLIC_APP_BASE_URL}` + endpoint, {
|
||||
return fetch(`${process.env.NEXT_PUBLIC_WEBAPP_URL}` + endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -81,7 +81,7 @@ export const ConfirmDialog = (props: IConfirmDialogWipe) => {
|
||||
|
||||
return (
|
||||
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
|
||||
<DialogContent>
|
||||
<DialogContent onOpenAutoFocus={(e) => e.preventDefault()}>
|
||||
<div className="flex flex-row space-x-3">
|
||||
<div className="flex h-10 w-10 flex-shrink-0 justify-center rounded-full bg-[#FAFAFA]">
|
||||
<ClockIcon className="m-auto h-6 w-6"></ClockIcon>
|
||||
@@ -99,9 +99,10 @@ export const ConfirmDialog = (props: IConfirmDialogWipe) => {
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<DialogClose>
|
||||
<Button color="secondary">{t("cancel")}</Button>
|
||||
</DialogClose>
|
||||
<Button color="secondary" onClick={() => setIsOpenDialog(false)}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
data-testid="send_request"
|
||||
disabled={isLoading}
|
||||
|
||||
@@ -32,7 +32,9 @@ const WipeMyCalActionButton = (props: IWipeMyCalActionButtonProps) => {
|
||||
{data && isSuccess && !isLoading && credentialId && (
|
||||
<>
|
||||
<ConfirmDialog trpc={trpc} isOpenDialog={openDialog} setIsOpenDialog={setOpenDialog} />
|
||||
<Button onClick={() => setOpenDialog(true)}>Wipe Today</Button>
|
||||
<Button onClick={() => setOpenDialog(true)} data-testid="wipe-today-button">
|
||||
Wipe Today
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -78,7 +78,7 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||
},
|
||||
});
|
||||
const [mainAttendee] = bookingToReschedule.attendees;
|
||||
// @NOTE: Should we assume attendees language?
|
||||
|
||||
const tAttendees = await getTranslation(mainAttendee.locale ?? "en", "common");
|
||||
const usersToPeopleType = (
|
||||
users: PersonAttendeeCommonFields[],
|
||||
@@ -139,19 +139,6 @@ const Reschedule = async (bookingUid: string, cancellationReason: string) => {
|
||||
logger.error(error.message);
|
||||
}
|
||||
}
|
||||
// Creating cancelled event as placeholders in calendars, remove when virtual calendar handles it
|
||||
try {
|
||||
const eventManager = new EventManager({
|
||||
credentials: userOwner.credentials,
|
||||
destinationCalendar: userOwner.destinationCalendar,
|
||||
});
|
||||
builder.calendarEvent.title = `Cancelled: ${builder.calendarEvent.title}`;
|
||||
await eventManager.updateAndSetCancelledPlaceholder(builder.calendarEvent, bookingToReschedule);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
logger.error(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Send emails
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user