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
@@ -213,6 +213,7 @@ export const Handler = async ({ ctx, input }: Options) => {
|
||||
eventTypeId: eventType?.id,
|
||||
videoCallData,
|
||||
customReplyToEmail: eventType?.customReplyToEmail,
|
||||
organizationId: user?.organizationId ?? null,
|
||||
team: updatedBooking.eventType?.team
|
||||
? {
|
||||
name: updatedBooking.eventType.team.name,
|
||||
|
||||
@@ -291,6 +291,7 @@ async function buildCalendarEvent(
|
||||
seatsPerTimeSlot: booking.eventType?.seatsPerTimeSlot,
|
||||
seatsShowAttendees: booking.eventType?.seatsShowAttendees,
|
||||
customReplyToEmail: booking.eventType?.customReplyToEmail,
|
||||
organizationId: booking.user?.profiles?.[0]?.organizationId ?? null,
|
||||
};
|
||||
|
||||
if (videoCallReference) {
|
||||
|
||||
@@ -253,6 +253,7 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
|
||||
}
|
||||
: undefined,
|
||||
...(platformClientParams ? platformClientParams : {}),
|
||||
organizationId: organizerOrganizationId ?? booking.eventType?.team?.parentId ?? null,
|
||||
additionalNotes: booking.description,
|
||||
};
|
||||
|
||||
|
||||
@@ -262,6 +262,7 @@ export async function editLocationHandler({ ctx, input }: EditLocationOptions) {
|
||||
const { booking, user: loggedInUser } = ctx;
|
||||
|
||||
const organizer = await new UserRepository(prisma).findByIdOrThrow({ id: booking.userId || 0 });
|
||||
const organizationId = booking.user?.profiles?.[0]?.organizationId ?? null;
|
||||
|
||||
const newLocationInEvtFormat = await getLocationInEvtFormatOrThrow({
|
||||
location: newLocation,
|
||||
@@ -274,6 +275,7 @@ export async function editLocationHandler({ ctx, input }: EditLocationOptions) {
|
||||
organizer,
|
||||
location: newLocationInEvtFormat,
|
||||
conferenceCredentialId,
|
||||
organizationId,
|
||||
});
|
||||
|
||||
const eventManager = new EventManager({
|
||||
|
||||
@@ -40,6 +40,11 @@ export const bookingsProcedure = authedProcedure
|
||||
include: {
|
||||
destinationCalendar: true,
|
||||
credentials: true,
|
||||
profiles: {
|
||||
select: {
|
||||
organizationId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -110,6 +115,7 @@ export type BookingsProcedureContext = {
|
||||
| (User & {
|
||||
destinationCalendar: DestinationCalendar | null;
|
||||
credentials: Credential[];
|
||||
profiles: { organizationId: number }[];
|
||||
})
|
||||
| null;
|
||||
references: BookingReference[];
|
||||
|
||||
@@ -99,6 +99,51 @@ const updateOrganizationSettings = async ({
|
||||
data.orgAutoJoinOnSignup = input.orgAutoJoinOnSignup;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeConfirmationEmail")) {
|
||||
data.disableAttendeeConfirmationEmail = input.disableAttendeeConfirmationEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeCancellationEmail")) {
|
||||
data.disableAttendeeCancellationEmail = input.disableAttendeeCancellationEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeRescheduledEmail")) {
|
||||
data.disableAttendeeRescheduledEmail = input.disableAttendeeRescheduledEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeRequestEmail")) {
|
||||
data.disableAttendeeRequestEmail = input.disableAttendeeRequestEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeReassignedEmail")) {
|
||||
data.disableAttendeeReassignedEmail = input.disableAttendeeReassignedEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeAwaitingPaymentEmail")) {
|
||||
data.disableAttendeeAwaitingPaymentEmail = input.disableAttendeeAwaitingPaymentEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeRescheduleRequestEmail")) {
|
||||
data.disableAttendeeRescheduleRequestEmail = input.disableAttendeeRescheduleRequestEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeLocationChangeEmail")) {
|
||||
data.disableAttendeeLocationChangeEmail = input.disableAttendeeLocationChangeEmail;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (input.hasOwnProperty("disableAttendeeNewEventEmail")) {
|
||||
data.disableAttendeeNewEventEmail = input.disableAttendeeNewEventEmail;
|
||||
}
|
||||
|
||||
// If no settings values have changed lets skip this update
|
||||
if (Object.keys(data).length === 0) return;
|
||||
|
||||
|
||||
@@ -37,6 +37,15 @@ export const ZUpdateInputSchema = z.object({
|
||||
disablePhoneOnlySMSNotifications: z.boolean().optional(),
|
||||
disableAutofillOnBookingPage: z.boolean().optional(),
|
||||
orgAutoJoinOnSignup: z.boolean().optional(),
|
||||
disableAttendeeConfirmationEmail: z.boolean().optional(),
|
||||
disableAttendeeCancellationEmail: z.boolean().optional(),
|
||||
disableAttendeeRescheduledEmail: z.boolean().optional(),
|
||||
disableAttendeeRequestEmail: z.boolean().optional(),
|
||||
disableAttendeeReassignedEmail: z.boolean().optional(),
|
||||
disableAttendeeAwaitingPaymentEmail: z.boolean().optional(),
|
||||
disableAttendeeRescheduleRequestEmail: z.boolean().optional(),
|
||||
disableAttendeeLocationChangeEmail: z.boolean().optional(),
|
||||
disableAttendeeNewEventEmail: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export type TUpdateInputSchema = z.infer<typeof ZUpdateInputSchema>;
|
||||
Reference in new issue
Block a user