fix: Fix for 'Scheduling by cal.com' is still showing in workflow emails even when branding is disabled (#18862)
* Branding Disabling on Team Workflows and Organization Workflows if branding is hidden * update * update --------- Co-authored-by: unknown <adhabal2002@gmail.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
This commit is contained in:
co-authored by
unknown
Anik Dhabal Babu
parent
641193bd61
commit
07a4aa6c7d
@@ -214,12 +214,16 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
),
|
||||
};
|
||||
const emailLocale = locale || "en";
|
||||
const brandingDisabled = reminder.booking.eventType?.team
|
||||
? !!reminder.booking.eventType?.team?.hideBranding
|
||||
: !!reminder.booking.user?.hideBranding;
|
||||
|
||||
const emailSubject = customTemplate(
|
||||
reminder.workflowStep.emailSubject || "",
|
||||
variables,
|
||||
emailLocale,
|
||||
getTimeFormatStringFromUserTimeFormat(reminder.booking.user?.timeFormat),
|
||||
!!reminder.booking.user?.hideBranding
|
||||
brandingDisabled
|
||||
).text;
|
||||
emailContent.emailSubject = emailSubject;
|
||||
emailContent.emailBody = customTemplate(
|
||||
@@ -227,7 +231,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
variables,
|
||||
emailLocale,
|
||||
getTimeFormatStringFromUserTimeFormat(reminder.booking.user?.timeFormat),
|
||||
!!reminder.booking.user?.hideBranding
|
||||
brandingDisabled
|
||||
).html;
|
||||
|
||||
emailBodyEmpty =
|
||||
@@ -238,6 +242,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
getTimeFormatStringFromUserTimeFormat(reminder.booking.user?.timeFormat)
|
||||
).text.length === 0;
|
||||
} else if (reminder.workflowStep.template === WorkflowTemplates.REMINDER) {
|
||||
const brandingDisabled = reminder.booking.eventType?.team
|
||||
? !!reminder.booking.eventType?.team?.hideBranding
|
||||
: !!reminder.booking.user?.hideBranding;
|
||||
|
||||
emailContent = emailReminderTemplate(
|
||||
false,
|
||||
reminder.booking.user?.locale || "en",
|
||||
@@ -251,7 +259,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
bookingMetadataSchema.parse(reminder.booking.metadata || {})?.videoCallUrl || "",
|
||||
attendeeName || "",
|
||||
name || "",
|
||||
!!reminder.booking.user?.hideBranding
|
||||
brandingDisabled
|
||||
);
|
||||
} else if (reminder.workflowStep.template === WorkflowTemplates.RATING) {
|
||||
const organizerOrganizationProfile = await prisma.profile.findFirst({
|
||||
@@ -368,6 +376,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
const emailBodyEmpty = false;
|
||||
|
||||
const brandingDisabled = reminder.booking.eventType?.team
|
||||
? !!reminder.booking.eventType?.team?.hideBranding
|
||||
: !!reminder.booking.user?.hideBranding;
|
||||
|
||||
emailContent = emailReminderTemplate(
|
||||
false,
|
||||
reminder.booking.user?.locale || "en",
|
||||
@@ -381,7 +393,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
bookingMetadataSchema.parse(reminder.booking.metadata || {})?.videoCallUrl || "",
|
||||
attendeeName || "",
|
||||
name || "",
|
||||
!!reminder.booking.user?.hideBranding
|
||||
brandingDisabled
|
||||
);
|
||||
if (emailContent.emailSubject.length > 0 && !emailBodyEmpty && sendTo) {
|
||||
const batchId = await getBatchId();
|
||||
|
||||
@@ -32,7 +32,7 @@ type PartialBooking =
|
||||
eventType:
|
||||
| (Partial<EventType> & {
|
||||
slug: string;
|
||||
team: { parentId?: number };
|
||||
team: { parentId?: number; hideBranding: boolean };
|
||||
hosts: { user: { email: string; destinationCalendar?: { primaryEmail: string } } }[] | undefined;
|
||||
})
|
||||
| null;
|
||||
@@ -186,6 +186,7 @@ export const select: Prisma.WorkflowReminderSelect = {
|
||||
team: {
|
||||
select: {
|
||||
parentId: true,
|
||||
hideBranding: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user