feat: Disable booking emails to guests (#25217)
* feat: disable SMS org setting * chore: undo * fix: cal evnet * feat: add more settings * tests: add email manager unit tests * fix: update * fix: type error * fix: test * refactor: UI * refactor: UI * perf: fetch only once * perf: fetch only once * chore: use org * fix: test * test: add unit tests * refactor: email manager * fix: add confirmation dialog for individual checkbox * fix: sms * chore: common.json
This commit is contained in:
1 parent
1c3ced5b70
commit
35d6c41fff
32 files changed
+936
-27
No files matched your search
@@ -184,7 +184,8 @@ export class CalendarEventBuilder {
|
||||
})
|
||||
.withRecurring(recurring)
|
||||
.withUid(uid)
|
||||
.withOneTimePassword(oneTimePassword);
|
||||
.withOneTimePassword(oneTimePassword)
|
||||
.withOrganization(organizationId);
|
||||
|
||||
// Seats
|
||||
if (seatsReferences?.length && bookingResponses) {
|
||||
@@ -499,6 +500,14 @@ export class CalendarEventBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
withOrganization(organizationId?: number | null) {
|
||||
this.event = {
|
||||
...this.event,
|
||||
organizationId,
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
withHashedLink(hashedLink?: string | null) {
|
||||
this.event = {
|
||||
...this.event,
|
||||
|
||||
@@ -23,6 +23,11 @@ export async function getBookingToDelete(id: number | undefined, uid: string | u
|
||||
name: true,
|
||||
destinationCalendar: true,
|
||||
locale: true,
|
||||
profiles: {
|
||||
select: {
|
||||
organizationId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
location: true,
|
||||
|
||||
@@ -313,6 +313,7 @@ async function handler(input: CancelBookingInput) {
|
||||
hideOrganizerEmail: bookingToDelete.eventType?.hideOrganizerEmail,
|
||||
platformBookingUrl,
|
||||
customReplyToEmail: bookingToDelete.eventType?.customReplyToEmail,
|
||||
organizationId: ownerProfile?.organizationId ?? null,
|
||||
};
|
||||
|
||||
const dataForWebhooks = { evt, webhooks, eventTypeInfo };
|
||||
|
||||
@@ -31,6 +31,9 @@ export const handleNoShowFee = async ({
|
||||
name?: string | null;
|
||||
locale: string | null;
|
||||
timeZone: string;
|
||||
profiles: {
|
||||
organizationId: number | null;
|
||||
}[];
|
||||
} | null;
|
||||
eventType: {
|
||||
title: string;
|
||||
@@ -97,6 +100,7 @@ export const handleNoShowFee = async ({
|
||||
currency: payment.currency,
|
||||
paymentOption: payment.paymentOption,
|
||||
},
|
||||
organizationId: booking.user?.profiles?.[0]?.organizationId ?? null,
|
||||
};
|
||||
|
||||
if (teamId) {
|
||||
|
||||
@@ -1394,6 +1394,7 @@ async function handler(
|
||||
platformCancelUrl,
|
||||
platformBookingUrl,
|
||||
})
|
||||
.withOrganization(organizerOrganizationId)
|
||||
.withHashedLink(hasHashedBookingLink ? reqBody.hashedLink ?? null : null)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -1383,6 +1383,19 @@ export class BookingRepository {
|
||||
metadata: true,
|
||||
},
|
||||
},
|
||||
user: {
|
||||
select: {
|
||||
email: true,
|
||||
name: true,
|
||||
timeZone: true,
|
||||
locale: true,
|
||||
profiles: {
|
||||
select: {
|
||||
organizationId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
payment: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -1425,6 +1438,11 @@ export class BookingRepository {
|
||||
include: {
|
||||
destinationCalendar: true,
|
||||
credentials: true,
|
||||
profiles: {
|
||||
select: {
|
||||
organizationId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -236,6 +236,11 @@ const handleDeleteCredential = async ({
|
||||
name: true,
|
||||
destinationCalendar: true,
|
||||
locale: true,
|
||||
profiles: {
|
||||
select: {
|
||||
organizationId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
location: true,
|
||||
@@ -357,6 +362,7 @@ const handleDeleteCredential = async ({
|
||||
members: [],
|
||||
}
|
||||
: undefined,
|
||||
organizationId: booking.user?.profiles?.[0]?.organizationId ?? null,
|
||||
},
|
||||
{
|
||||
eventName: booking?.eventType?.eventName,
|
||||
|
||||
+324
@@ -0,0 +1,324 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { EmailType } from "@calcom/emails/email-types";
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc";
|
||||
import { Alert } from "@calcom/ui/components/alert";
|
||||
import { ConfirmationDialogContent } from "@calcom/ui/components/dialog";
|
||||
import { Checkbox, SettingsToggle } from "@calcom/ui/components/form";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
const EMAIL_TYPE_TO_SETTING_KEY = {
|
||||
[EmailType.CONFIRMATION]: "disableAttendeeConfirmationEmail",
|
||||
[EmailType.CANCELLATION]: "disableAttendeeCancellationEmail",
|
||||
[EmailType.RESCHEDULED]: "disableAttendeeRescheduledEmail",
|
||||
[EmailType.REQUEST]: "disableAttendeeRequestEmail",
|
||||
[EmailType.REASSIGNED]: "disableAttendeeReassignedEmail",
|
||||
[EmailType.AWAITING_PAYMENT]: "disableAttendeeAwaitingPaymentEmail",
|
||||
[EmailType.RESCHEDULE_REQUEST]: "disableAttendeeRescheduleRequestEmail",
|
||||
[EmailType.LOCATION_CHANGE]: "disableAttendeeLocationChangeEmail",
|
||||
[EmailType.NEW_EVENT]: "disableAttendeeNewEventEmail",
|
||||
} as const;
|
||||
|
||||
type EmailSettings = Record<EmailType, boolean>;
|
||||
|
||||
interface EmailRowProps {
|
||||
emailType: EmailType;
|
||||
labelKey: string;
|
||||
descriptionKey: string;
|
||||
isDisabled: boolean;
|
||||
onToggle: (type: EmailType, disabled: boolean) => void;
|
||||
testId: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const EmailRow = ({
|
||||
emailType,
|
||||
labelKey,
|
||||
descriptionKey,
|
||||
isDisabled,
|
||||
onToggle,
|
||||
testId,
|
||||
disabled,
|
||||
}: EmailRowProps) => {
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td className="text-default px-6 py-4 text-sm font-medium">{t(labelKey)}</td>
|
||||
<td className="text-default px-6 py-4 text-sm">{t(descriptionKey)}</td>
|
||||
<td className="px-6 py-4 text-center">
|
||||
<Checkbox
|
||||
checked={!isDisabled}
|
||||
onCheckedChange={(checked) => onToggle(emailType, !checked)}
|
||||
data-testid={testId}
|
||||
disabled={disabled}
|
||||
aria-label={t(labelKey)}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
};
|
||||
|
||||
interface IDisableGuestBookingEmailsSettingProps {
|
||||
orgId: number;
|
||||
settings: {
|
||||
disableAttendeeConfirmationEmail: boolean;
|
||||
disableAttendeeCancellationEmail: boolean;
|
||||
disableAttendeeRescheduledEmail: boolean;
|
||||
disableAttendeeRequestEmail: boolean;
|
||||
disableAttendeeReassignedEmail: boolean;
|
||||
disableAttendeeAwaitingPaymentEmail: boolean;
|
||||
disableAttendeeRescheduleRequestEmail: boolean;
|
||||
disableAttendeeLocationChangeEmail: boolean;
|
||||
disableAttendeeNewEventEmail: boolean;
|
||||
};
|
||||
readOnly?: boolean;
|
||||
}
|
||||
|
||||
const EMAIL_TYPE_LABELS: Record<EmailType, string> = {
|
||||
[EmailType.CONFIRMATION]: "confirmation",
|
||||
[EmailType.CANCELLATION]: "cancellation",
|
||||
[EmailType.RESCHEDULED]: "rescheduled",
|
||||
[EmailType.REQUEST]: "request",
|
||||
[EmailType.REASSIGNED]: "host_reassignment",
|
||||
[EmailType.AWAITING_PAYMENT]: "awaiting_payment",
|
||||
[EmailType.RESCHEDULE_REQUEST]: "reschedule_request",
|
||||
[EmailType.LOCATION_CHANGE]: "location_change",
|
||||
[EmailType.NEW_EVENT]: "guest_added",
|
||||
};
|
||||
|
||||
const DisableGuestBookingEmailsSetting = (props: IDisableGuestBookingEmailsSettingProps) => {
|
||||
const { readOnly = false } = props;
|
||||
const utils = trpc.useUtils();
|
||||
const { t } = useLocale();
|
||||
|
||||
const [showConfirmDialog, setShowConfirmDialog] = useState(false);
|
||||
const [dialogAction, setDialogAction] = useState<"enable" | "disable">("disable");
|
||||
const [dialogMode, setDialogMode] = useState<"all" | "individual">("all");
|
||||
const [pendingEmailType, setPendingEmailType] = useState<EmailType | null>(null);
|
||||
|
||||
const [emailSettings, setEmailSettings] = useState<EmailSettings>({
|
||||
[EmailType.CONFIRMATION]: props.settings.disableAttendeeConfirmationEmail,
|
||||
[EmailType.CANCELLATION]: props.settings.disableAttendeeCancellationEmail,
|
||||
[EmailType.RESCHEDULED]: props.settings.disableAttendeeRescheduledEmail,
|
||||
[EmailType.REQUEST]: props.settings.disableAttendeeRequestEmail,
|
||||
[EmailType.REASSIGNED]: props.settings.disableAttendeeReassignedEmail,
|
||||
[EmailType.AWAITING_PAYMENT]: props.settings.disableAttendeeAwaitingPaymentEmail,
|
||||
[EmailType.RESCHEDULE_REQUEST]: props.settings.disableAttendeeRescheduleRequestEmail,
|
||||
[EmailType.LOCATION_CHANGE]: props.settings.disableAttendeeLocationChangeEmail,
|
||||
[EmailType.NEW_EVENT]: props.settings.disableAttendeeNewEventEmail,
|
||||
});
|
||||
|
||||
const allDisabled = Object.values(emailSettings).every(Boolean);
|
||||
|
||||
const mutation = trpc.viewer.organizations.update.useMutation({
|
||||
onSuccess: async () => {
|
||||
showToast(t("your_org_updated_successfully"), "success");
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("error_updating_settings"), "error");
|
||||
},
|
||||
onSettled: () => {
|
||||
utils.viewer.organizations.listCurrent.invalidate();
|
||||
},
|
||||
});
|
||||
|
||||
const handleDisableAll = (disable: boolean) => {
|
||||
const apiPayload = Object.fromEntries(
|
||||
Object.values(EMAIL_TYPE_TO_SETTING_KEY).map((key) => [key, disable])
|
||||
);
|
||||
mutation.mutate(apiPayload);
|
||||
|
||||
setEmailSettings(
|
||||
Object.fromEntries(Object.values(EmailType).map((type) => [type, disable])) as EmailSettings
|
||||
);
|
||||
};
|
||||
|
||||
const handleIndividualToggle = (type: EmailType, disabled: boolean) => {
|
||||
if (disabled) {
|
||||
setPendingEmailType(type);
|
||||
setDialogAction("disable");
|
||||
setDialogMode("individual");
|
||||
setShowConfirmDialog(true);
|
||||
} else {
|
||||
const settingKey = EMAIL_TYPE_TO_SETTING_KEY[type];
|
||||
mutation.mutate({ [settingKey]: false });
|
||||
setEmailSettings((prev) => ({ ...prev, [type]: false }));
|
||||
}
|
||||
};
|
||||
|
||||
const confirmIndividualToggle = () => {
|
||||
if (pendingEmailType === null) return;
|
||||
const settingKey = EMAIL_TYPE_TO_SETTING_KEY[pendingEmailType];
|
||||
const shouldDisable = dialogAction === "disable";
|
||||
mutation.mutate({ [settingKey]: shouldDisable });
|
||||
setEmailSettings((prev) => ({ ...prev, [pendingEmailType]: shouldDisable }));
|
||||
setPendingEmailType(null);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<Dialog open={showConfirmDialog} onOpenChange={setShowConfirmDialog}>
|
||||
<ConfirmationDialogContent
|
||||
variety={dialogAction === "disable" ? "danger" : "warning"}
|
||||
title={
|
||||
dialogMode === "all"
|
||||
? t(
|
||||
dialogAction === "disable"
|
||||
? "disable_all_guest_booking_emails_confirm_title"
|
||||
: "enable_all_guest_booking_emails_confirm_title"
|
||||
)
|
||||
: t("disable_individual_guest_email_confirm_title", {
|
||||
emailType: pendingEmailType ? t(EMAIL_TYPE_LABELS[pendingEmailType]) : "",
|
||||
})
|
||||
}
|
||||
confirmBtnText={t(
|
||||
dialogMode === "all"
|
||||
? dialogAction === "disable"
|
||||
? "disable_all"
|
||||
: "enable_all"
|
||||
: "disable_email"
|
||||
)}
|
||||
onConfirm={() => {
|
||||
if (dialogMode === "all") {
|
||||
handleDisableAll(dialogAction === "disable");
|
||||
} else {
|
||||
confirmIndividualToggle();
|
||||
}
|
||||
setShowConfirmDialog(false);
|
||||
}}>
|
||||
<p className="mt-2">
|
||||
{dialogMode === "all"
|
||||
? t(
|
||||
dialogAction === "disable"
|
||||
? "disable_all_guest_booking_emails_confirm_description"
|
||||
: "enable_all_guest_booking_emails_confirm_description"
|
||||
)
|
||||
: t("disable_individual_guest_email_confirm_description", {
|
||||
emailType: pendingEmailType ? t(EMAIL_TYPE_LABELS[pendingEmailType]) : "",
|
||||
})}
|
||||
</p>
|
||||
</ConfirmationDialogContent>
|
||||
</Dialog>
|
||||
|
||||
<Alert severity="warning" title={t("disable_guest_emails_warning")} />
|
||||
|
||||
<SettingsToggle
|
||||
toggleSwitchAtTheEnd={true}
|
||||
checked={allDisabled}
|
||||
title={t("disable_all_booking_emails_to_guests")}
|
||||
labelClassName="text-sm font-semibold"
|
||||
description={t("disable_all_booking_emails_to_guests_description")}
|
||||
switchContainerClassName="border-subtle rounded-lg border py-6 px-4 sm:px-6"
|
||||
data-testid="disable-all-guest-emails"
|
||||
disabled={readOnly}
|
||||
onCheckedChange={(checked) => {
|
||||
setDialogAction(checked ? "disable" : "enable");
|
||||
setDialogMode("all");
|
||||
setShowConfirmDialog(true);
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="border-subtle overflow-hidden rounded-lg border">
|
||||
<table className="w-full">
|
||||
<thead>
|
||||
<tr className="bg-muted border-subtle border-b">
|
||||
<th className="text-emphasis px-6 py-3 text-left text-sm font-medium">{t("email_type")}</th>
|
||||
<th className="text-emphasis px-6 py-3 text-left text-sm font-medium">{t("description")}</th>
|
||||
<th className="text-emphasis px-6 py-3 text-right text-sm font-medium">{t("enabled")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-subtle divide-y">
|
||||
<EmailRow
|
||||
emailType={EmailType.CONFIRMATION}
|
||||
labelKey="confirmation"
|
||||
descriptionKey="guest_confirmation_email_description"
|
||||
isDisabled={emailSettings[EmailType.CONFIRMATION]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-guest-confirmation-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.CANCELLATION}
|
||||
labelKey="cancellation"
|
||||
descriptionKey="guest_cancellation_email_description"
|
||||
isDisabled={emailSettings[EmailType.CANCELLATION]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-guest-cancellation-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.RESCHEDULED}
|
||||
labelKey="rescheduled"
|
||||
descriptionKey="guest_rescheduled_email_description"
|
||||
isDisabled={emailSettings[EmailType.RESCHEDULED]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-guest-rescheduled-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.REQUEST}
|
||||
labelKey="request"
|
||||
descriptionKey="attendee_request_email_description"
|
||||
isDisabled={emailSettings[EmailType.REQUEST]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-attendee-request-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.REASSIGNED}
|
||||
labelKey="host_reassignment"
|
||||
descriptionKey="attendee_reassigned_email_description"
|
||||
isDisabled={emailSettings[EmailType.REASSIGNED]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-attendee-reassigned-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.AWAITING_PAYMENT}
|
||||
labelKey="awaiting_payment"
|
||||
descriptionKey="attendee_awaiting_payment_email_description"
|
||||
isDisabled={emailSettings[EmailType.AWAITING_PAYMENT]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-attendee-awaiting-payment-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.RESCHEDULE_REQUEST}
|
||||
labelKey="reschedule_request"
|
||||
descriptionKey="attendee_reschedule_request_email_description"
|
||||
isDisabled={emailSettings[EmailType.RESCHEDULE_REQUEST]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-attendee-reschedule-request-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.LOCATION_CHANGE}
|
||||
labelKey="location_change"
|
||||
descriptionKey="attendee_location_change_email_description"
|
||||
isDisabled={emailSettings[EmailType.LOCATION_CHANGE]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-attendee-location-change-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
<EmailRow
|
||||
emailType={EmailType.NEW_EVENT}
|
||||
labelKey="guest_added"
|
||||
descriptionKey="attendee_new_event_email_description"
|
||||
isDisabled={emailSettings[EmailType.NEW_EVENT]}
|
||||
onToggle={handleIndividualToggle}
|
||||
testId="disable-attendee-new-event-email"
|
||||
disabled={readOnly || allDisabled}
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DisableGuestBookingEmailsSetting;
|
||||
@@ -0,0 +1,65 @@
|
||||
"use client";
|
||||
|
||||
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { SkeletonContainer, SkeletonText, SkeletonButton } from "@calcom/ui/components/skeleton";
|
||||
|
||||
import DisableGuestBookingEmailsSetting from "../components/DisableGuestBookingEmailsSetting";
|
||||
|
||||
const SkeletonLoader = () => {
|
||||
return (
|
||||
<SkeletonContainer>
|
||||
<div className="mb-8 mt-6 space-y-6">
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
<SkeletonText className="h-8 w-full" />
|
||||
<SkeletonButton className="mr-6 h-8 w-20 rounded-md p-5" />
|
||||
</div>
|
||||
</SkeletonContainer>
|
||||
);
|
||||
};
|
||||
|
||||
const GuestNotificationsView = ({ permissions }: { permissions: { canRead: boolean; canEdit: boolean } }) => {
|
||||
const { data: currentOrg, isPending } = trpc.viewer.organizations.listCurrent.useQuery();
|
||||
const isInviteOpen = !currentOrg?.user.accepted;
|
||||
const isDisabled = !permissions.canEdit || isInviteOpen;
|
||||
|
||||
if (isPending) return <SkeletonLoader />;
|
||||
|
||||
if (!currentOrg) return null;
|
||||
|
||||
if (!currentOrg.organizationSettings) return null;
|
||||
|
||||
return (
|
||||
<LicenseRequired>
|
||||
<div className="space-y-8">
|
||||
<DisableGuestBookingEmailsSetting
|
||||
orgId={currentOrg.id}
|
||||
settings={{
|
||||
disableAttendeeConfirmationEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeConfirmationEmail ?? false,
|
||||
disableAttendeeCancellationEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeCancellationEmail ?? false,
|
||||
disableAttendeeRescheduledEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeRescheduledEmail ?? false,
|
||||
disableAttendeeRequestEmail: currentOrg.organizationSettings.disableAttendeeRequestEmail ?? false,
|
||||
disableAttendeeReassignedEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeReassignedEmail ?? false,
|
||||
disableAttendeeAwaitingPaymentEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeAwaitingPaymentEmail ?? false,
|
||||
disableAttendeeRescheduleRequestEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeRescheduleRequestEmail ?? false,
|
||||
disableAttendeeLocationChangeEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeLocationChangeEmail ?? false,
|
||||
disableAttendeeNewEventEmail:
|
||||
currentOrg.organizationSettings.disableAttendeeNewEventEmail ?? false,
|
||||
}}
|
||||
readOnly={isDisabled}
|
||||
/>
|
||||
</div>
|
||||
</LicenseRequired>
|
||||
);
|
||||
};
|
||||
|
||||
export default GuestNotificationsView;
|
||||
@@ -289,6 +289,15 @@ export class OrganizationRepository {
|
||||
disablePhoneOnlySMSNotifications: true,
|
||||
disableAutofillOnBookingPage: true,
|
||||
orgAutoJoinOnSignup: true,
|
||||
disableAttendeeConfirmationEmail: true,
|
||||
disableAttendeeCancellationEmail: true,
|
||||
disableAttendeeRescheduledEmail: true,
|
||||
disableAttendeeRequestEmail: true,
|
||||
disableAttendeeReassignedEmail: true,
|
||||
disableAttendeeAwaitingPaymentEmail: true,
|
||||
disableAttendeeRescheduleRequestEmail: true,
|
||||
disableAttendeeLocationChangeEmail: true,
|
||||
disableAttendeeNewEventEmail: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -309,6 +318,15 @@ export class OrganizationRepository {
|
||||
disablePhoneOnlySMSNotifications: organizationSettings?.disablePhoneOnlySMSNotifications,
|
||||
disableAutofillOnBookingPage: organizationSettings?.disableAutofillOnBookingPage,
|
||||
orgAutoJoinOnSignup: organizationSettings?.orgAutoJoinOnSignup,
|
||||
disableAttendeeConfirmationEmail: organizationSettings?.disableAttendeeConfirmationEmail,
|
||||
disableAttendeeCancellationEmail: organizationSettings?.disableAttendeeCancellationEmail,
|
||||
disableAttendeeRescheduledEmail: organizationSettings?.disableAttendeeRescheduledEmail,
|
||||
disableAttendeeRequestEmail: organizationSettings?.disableAttendeeRequestEmail,
|
||||
disableAttendeeReassignedEmail: organizationSettings?.disableAttendeeReassignedEmail,
|
||||
disableAttendeeAwaitingPaymentEmail: organizationSettings?.disableAttendeeAwaitingPaymentEmail,
|
||||
disableAttendeeRescheduleRequestEmail: organizationSettings?.disableAttendeeRescheduleRequestEmail,
|
||||
disableAttendeeLocationChangeEmail: organizationSettings?.disableAttendeeLocationChangeEmail,
|
||||
disableAttendeeNewEventEmail: organizationSettings?.disableAttendeeNewEventEmail,
|
||||
},
|
||||
user: {
|
||||
role: membership?.role,
|
||||
|
||||
@@ -313,6 +313,7 @@ export const roundRobinManualReassignment = async ({
|
||||
location: bookingLocation,
|
||||
...(platformClientParams ? platformClientParams : {}),
|
||||
conferenceCredentialId: conferenceCredentialId ?? undefined,
|
||||
organizationId: orgId,
|
||||
};
|
||||
|
||||
if (hasOrganizerChanged) {
|
||||
|
||||
@@ -340,6 +340,7 @@ export const roundRobinReassignment = async ({
|
||||
customReplyToEmail: eventType?.customReplyToEmail,
|
||||
location: bookingLocation,
|
||||
...(platformClientParams ? platformClientParams : {}),
|
||||
organizationId: orgId,
|
||||
};
|
||||
|
||||
if (hasOrganizerChanged) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
|
||||
export class OrganizationSettingsRepository {
|
||||
constructor(private prismaClient: PrismaClient) {}
|
||||
|
||||
async getEmailSettings(organizationId: number) {
|
||||
return await this.prismaClient.organizationSettings.findUnique({
|
||||
where: { organizationId },
|
||||
select: {
|
||||
disableAttendeeConfirmationEmail: true,
|
||||
disableAttendeeCancellationEmail: true,
|
||||
disableAttendeeRescheduledEmail: true,
|
||||
disableAttendeeRequestEmail: true,
|
||||
disableAttendeeReassignedEmail: true,
|
||||
disableAttendeeAwaitingPaymentEmail: true,
|
||||
disableAttendeeRescheduleRequestEmail: true,
|
||||
disableAttendeeLocationChangeEmail: true,
|
||||
disableAttendeeNewEventEmail: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user