fix/4128-reschedulebook-stops-creating-event-calendar (#4348)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
alannncandkodiakhq[bot] authored and GitHub committed 2022-09-15 01:27:46 +00:00
1 parent 2281c7cf9f
commit 35c2f9046a
15 files changed
+40 -32

No files matched your search

+2 -1
View File
@@ -259,7 +259,7 @@ export default function Success(props: SuccessProps) {
);
const customInputs = bookingInfo?.customInputs;
const locationToDisplay = getSuccessPageLocationMessage(location, t);
const locationToDisplay = getSuccessPageLocationMessage(location, t, props?.bookingInfo?.status);
return (
<div className={isEmbed ? "" : "h-screen"} data-testid="success-page">
@@ -825,6 +825,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
select: {
title: true,
uid: true,
status: true,
description: true,
customInputs: true,
user: {
@@ -67,12 +67,14 @@
"event_still_awaiting_approval": "An event is still waiting for your approval",
"booking_submitted_subject": "Booking Submitted: {{eventType}} with {{name}} at {{date}}",
"your_meeting_has_been_booked": "Your meeting has been booked",
"event_type_has_been_rescheduled_on_time_date": "Your {{eventType}} with {{name}} has been rescheduled to {{time}} ({{timeZone}}) on {{date}}.",
"event_type_has_been_rescheduled_on_time_date": "Your {{eventType}} with {{name}} has been rescheduled to {{date}}.",
"event_has_been_rescheduled": "Updated - Your event has been rescheduled",
"request_reschedule_title_attendee": "Request to reschedule your booking",
"request_reschedule_subtitle": "{{organizer}} has cancelled the booking and requested you to pick another time.",
"request_reschedule_title_organizer": "You have requested {{attendee}} to reschedule",
"request_reschedule_subtitle_organizer": "You have cancelled the booking and {{attendee}} should pick a new booking time with you.",
"rescheduled_event_type_subject": "Request for reschedule sent: {{eventType}} with {{name}} at {{date}}",
"requested_to_reschedule_subject_attendee": "Action Required Reschedule: Please book a new time for {{eventType}} with {{name}}",
"reschedule_reason": "Reason for reschedule",
"hi_user_name": "Hi {{name}}",
"ics_event_title": "{{eventType}} with {{name}}",
@@ -92,8 +94,6 @@
"meeting_password": "Meeting Password",
"meeting_url": "Meeting URL",
"meeting_request_rejected": "Your meeting request has been rejected",
"rescheduled_event_type_subject": "Request for reschedule sent: {{eventType}} with {{name}} at {{date}}",
"requested_to_reschedule_subject_attendee": "Action Required Reschedule: Please book a new time for {{eventType}} with {{name}}",
"rejected_event_type_with_organizer": "Rejected: {{eventType}} with {{organizer}} on {{date}}",
"hi": "Hi",
"join_team": "Join team",
+7 -3
View File
@@ -310,13 +310,17 @@ export const getEventLocationValue = (eventLocations: LocationObject[], bookingL
);
};
export function getSuccessPageLocationMessage(location: EventLocationType["type"], t: TFunction) {
export function getSuccessPageLocationMessage(
location: EventLocationType["type"],
t: TFunction,
bookingStatus?: BookingStatus
) {
const eventLocationType = getEventLocationType(location);
let locationToDisplay = location;
if (eventLocationType && !eventLocationType.default && eventLocationType.linkType === "dynamic") {
const isConfirmed = status === BookingStatus.ACCEPTED;
const isConfirmed = bookingStatus === BookingStatus.ACCEPTED;
if (status === BookingStatus.CANCELLED || status === BookingStatus.REJECTED) {
if (bookingStatus === BookingStatus.CANCELLED || bookingStatus === BookingStatus.REJECTED) {
locationToDisplay == t("web_conference");
} else if (isConfirmed) {
locationToDisplay =
+8 -8
View File
@@ -5,9 +5,9 @@ import AttendeeCancelledEmail from "./templates/attendee-cancelled-email";
import AttendeeDeclinedEmail from "./templates/attendee-declined-email";
import AttendeeLocationChangeEmail from "./templates/attendee-location-change-email";
import AttendeeRequestEmail from "./templates/attendee-request-email";
import AttendeeRequestRescheduledEmail from "./templates/attendee-request-reschedule-email";
import AttendeeRescheduledEmail from "./templates/attendee-rescheduled-email";
import AttendeeScheduledEmail from "./templates/attendee-scheduled-email";
import AttendeeWasRequestedToRescheduleEmail from "./templates/attendee-was-requested-to-reschedule-email";
import BrokenIntegrationEmail from "./templates/broken-integration-email";
import FeedbackEmail, { Feedback } from "./templates/feedback-email";
import ForgotPasswordEmail, { PasswordReset } from "./templates/forgot-password-email";
@@ -16,7 +16,7 @@ import OrganizerLocationChangeEmail from "./templates/organizer-location-change-
import OrganizerPaymentRefundFailedEmail from "./templates/organizer-payment-refund-failed-email";
import OrganizerRequestEmail from "./templates/organizer-request-email";
import OrganizerRequestReminderEmail from "./templates/organizer-request-reminder-email";
import OrganizerRequestRescheduleEmail from "./templates/organizer-request-reschedule-email";
import OrganizerRequestedToRescheduleEmail from "./templates/organizer-requested-to-reschedule-email";
import OrganizerRescheduledEmail from "./templates/organizer-rescheduled-email";
import OrganizerScheduledEmail from "./templates/organizer-scheduled-email";
import TeamInviteEmail, { TeamInvite } from "./templates/team-invite-email";
@@ -53,7 +53,7 @@ export const sendScheduledEmails = async (calEvent: CalendarEvent) => {
export const sendRescheduledEmails = async (calEvent: CalendarEvent) => {
const emailsToSend: Promise<unknown>[] = [];
// @TODO: we should obtain who is rescheduling the event and send them a different email
emailsToSend.push(
...calEvent.attendees.map((attendee) => {
return new Promise((resolve, reject) => {
@@ -73,7 +73,7 @@ export const sendRescheduledEmails = async (calEvent: CalendarEvent) => {
const scheduledEmail = new OrganizerRescheduledEmail(calEvent);
resolve(scheduledEmail.sendEmail());
} catch (e) {
reject(console.error("OrganizerScheduledEmail.sendEmail failed", e));
reject(console.error("OrganizerRescheduledEmail.sendEmail failed", e));
}
})
);
@@ -255,10 +255,10 @@ export const sendRequestRescheduleEmail = async (
emailsToSend.push(
new Promise((resolve, reject) => {
try {
const requestRescheduleEmail = new AttendeeRequestRescheduledEmail(calEvent, metadata);
const requestRescheduleEmail = new AttendeeWasRequestedToRescheduleEmail(calEvent, metadata);
resolve(requestRescheduleEmail.sendEmail());
} catch (e) {
reject(console.error("AttendeeRequestRescheduledEmail.sendEmail failed", e));
reject(console.error("AttendeeWasRequestedToRescheduleEmail.sendEmail failed", e));
}
})
);
@@ -266,10 +266,10 @@ export const sendRequestRescheduleEmail = async (
emailsToSend.push(
new Promise((resolve, reject) => {
try {
const requestRescheduleEmail = new OrganizerRequestRescheduleEmail(calEvent, metadata);
const requestRescheduleEmail = new OrganizerRequestedToRescheduleEmail(calEvent, metadata);
resolve(requestRescheduleEmail.sendEmail());
} catch (e) {
reject(console.error("OrganizerRequestRescheduledEmail.sendEmail failed", e));
reject(console.error("OrganizerRequestedToRescheduleEmail.sendEmail failed", e));
}
})
);
@@ -4,7 +4,7 @@ export const AttendeeRescheduledEmail = (props: React.ComponentProps<typeof Atte
<AttendeeScheduledEmail
title="event_has_been_rescheduled"
headerType="calendarCircle"
subject="rescheduled_event_type_subject"
subject="event_type_has_been_rescheduled_on_time_date"
{...props}
/>
);
@@ -1,7 +1,7 @@
import { CallToAction, CallToActionTable } from "../components";
import { OrganizerScheduledEmail } from "./OrganizerScheduledEmail";
export const AttendeeRequestRescheduledEmail = (
export const AttendeeWasRequestedToRescheduleEmail = (
props: { metadata: { rescheduleLink: string } } & React.ComponentProps<typeof OrganizerScheduledEmail>
) => (
<OrganizerScheduledEmail
@@ -1,6 +1,6 @@
import { OrganizerScheduledEmail } from "./OrganizerScheduledEmail";
export const OrganizerRequestRescheduledEmail = (
export const OrganizerRequestedToRescheduleEmail = (
props: React.ComponentProps<typeof OrganizerScheduledEmail>
) => (
<OrganizerScheduledEmail
@@ -4,7 +4,7 @@ export const OrganizerRescheduledEmail = (props: React.ComponentProps<typeof Org
<OrganizerScheduledEmail
title="event_has_been_rescheduled"
headerType="calendarCircle"
subject="rescheduled_event_type_subject"
subject="event_type_has_been_rescheduled_on_time_date"
{...props}
/>
);
+2 -2
View File
@@ -3,7 +3,7 @@ export { AttendeeCancelledEmail } from "./AttendeeCancelledEmail";
export { AttendeeDeclinedEmail } from "./AttendeeDeclinedEmail";
export { AttendeeLocationChangeEmail } from "./AttendeeLocationChangeEmail";
export { AttendeeRequestEmail } from "./AttendeeRequestEmail";
export { AttendeeRequestRescheduledEmail } from "./AttendeeRequestRescheduledEmail";
export { AttendeeWasRequestedToRescheduleEmail } from "./AttendeeWasRequestedToRescheduleEmail";
export { AttendeeRescheduledEmail } from "./AttendeeRescheduledEmail";
export { AttendeeScheduledEmail } from "./AttendeeScheduledEmail";
export { FeedbackEmail } from "./FeedbackEmail";
@@ -13,7 +13,7 @@ export { OrganizerLocationChangeEmail } from "./OrganizerLocationChangeEmail";
export { OrganizerPaymentRefundFailedEmail } from "./OrganizerPaymentRefundFailedEmail";
export { OrganizerRequestEmail } from "./OrganizerRequestEmail";
export { OrganizerRequestReminderEmail } from "./OrganizerRequestReminderEmail";
export { OrganizerRequestRescheduledEmail } from "./OrganizerRequestRescheduledEmail";
export { OrganizerRequestedToRescheduleEmail } from "./OrganizerRequestedToRescheduleEmail";
export { OrganizerRescheduledEmail } from "./OrganizerRescheduledEmail";
export { OrganizerScheduledEmail } from "./OrganizerScheduledEmail";
export { TeamInviteEmail } from "./TeamInviteEmail";
@@ -11,12 +11,12 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],
subject: `${this.attendee.language.translate("rescheduled_event_type_subject", {
subject: `${this.attendee.language.translate("event_type_has_been_rescheduled_on_time_date", {
eventType: this.calEvent.type,
name: this.calEvent.team?.name || this.calEvent.organizer.name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeCancelledEmail", {
html: renderEmail("AttendeeRescheduledEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -71,7 +71,7 @@ export default class AttendeeScheduledEmail extends BaseEmail {
name: this.calEvent.team?.name || this.calEvent.organizer.name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeScheduledEmail", {
html: renderEmail("AttendeeRescheduledEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -4,10 +4,10 @@ import dayjs from "@calcom/dayjs";
import { getCancelLink } from "@calcom/lib/CalEventParser";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { renderEmail } from "../";
import { renderEmail } from "..";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class AttendeeRequestRescheduledEmail extends OrganizerScheduledEmail {
export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerScheduledEmail {
private metadata: { rescheduleLink: string };
constructor(calEvent: CalendarEvent, metadata: { rescheduleLink: string }) {
super(calEvent);
@@ -27,7 +27,7 @@ export default class AttendeeRequestRescheduledEmail extends OrganizerScheduledE
eventType: this.calEvent.type,
name: this.calEvent.attendees[0].name,
})}`,
html: renderEmail("AttendeeRequestRescheduledEmail", {
html: renderEmail("AttendeeWasRequestedToRescheduleEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
metadata: this.metadata,
@@ -4,10 +4,10 @@ import dayjs from "@calcom/dayjs";
import { getRichDescription } from "@calcom/lib/CalEventParser";
import type { CalendarEvent } from "@calcom/types/Calendar";
import { renderEmail } from "../";
import { renderEmail } from "..";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerRequestRescheduledEmail extends OrganizerScheduledEmail {
export default class OrganizerRequestedToRescheduleEmail extends OrganizerScheduledEmail {
private metadata: { rescheduleLink: string };
constructor(calEvent: CalendarEvent, metadata: { rescheduleLink: string }) {
super(calEvent);
@@ -28,7 +28,7 @@ export default class OrganizerRequestRescheduledEmail extends OrganizerScheduled
name: this.calEvent.attendees[0].name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerRequestRescheduledEmail", {
html: renderEmail("OrganizerRequestedToRescheduleEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
@@ -20,7 +20,7 @@ export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
},
from: `Cal.com <${this.getMailerOptions().from}>`,
to: toAddresses.join(","),
subject: `${this.calEvent.organizer.language.translate("rescheduled_event_type_subject", {
subject: `${this.calEvent.organizer.language.translate("event_type_has_been_rescheduled_on_time_date", {
eventType: this.calEvent.type,
name: this.calEvent.attendees[0].name,
date: `${this.getOrganizerStart("h:mma")} - ${this.getOrganizerEnd(
+4 -1
View File
@@ -93,7 +93,10 @@ export const getLocation = (calEvent: CalendarEvent) => {
export const getProviderName = (calEvent: CalendarEvent): string => {
// TODO: use getAppName from @calcom/app-store
if (calEvent.location && calEvent.location.includes("integrations:")) {
const location = calEvent.location.split(":")[1];
let location = calEvent.location.split(":")[1];
if (location === "daily") {
location = "Cal Video";
}
return location[0].toUpperCase() + location.slice(1);
}
// If location its a url, probably we should be validating it with a custom library