Feat - disable notes (#2249)
* Feat - disable notes Stops notes from showing in calendar when checked. * Removing index rename * Update apps/web/lib/integrations/calendar/interfaces/Calendar.ts Co-authored-by: Omar López <zomars@me.com> * Rename to hideCalendarNotes * Update schema.prisma * Update webhookResponse-chromium.txt Co-authored-by: Bailey Pumfleet <pumfleet@hey.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Bailey Pumfleet <bailey@pumfleet.co.uk> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
parent
4f1a380969
commit
bd66ca183f
7 changed files with 22 additions and 9 deletions
|
@ -232,6 +232,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
currency: true,
|
currency: true,
|
||||||
metadata: true,
|
metadata: true,
|
||||||
destinationCalendar: true,
|
destinationCalendar: true,
|
||||||
|
hideCalendarNotes: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -342,6 +343,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
location: reqBody.location, // Will be processed by the EventManager later.
|
location: reqBody.location, // Will be processed by the EventManager later.
|
||||||
/** For team events, we will need to handle each member destinationCalendar eventually */
|
/** For team events, we will need to handle each member destinationCalendar eventually */
|
||||||
destinationCalendar: eventType.destinationCalendar || users[0].destinationCalendar,
|
destinationCalendar: eventType.destinationCalendar || users[0].destinationCalendar,
|
||||||
|
hideCalendarNotes: eventType.hideCalendarNotes,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (eventType.schedulingType === SchedulingType.COLLECTIVE) {
|
if (eventType.schedulingType === SchedulingType.COLLECTIVE) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}
|
{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}}
|
|
@ -566,6 +566,8 @@
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"add_input": "Add an Input",
|
"add_input": "Add an Input",
|
||||||
|
"disable_notes": "Hide notes in calendar",
|
||||||
|
"disable_notes_description": "For privacy reasons, additional inputs and notes will be hidden in the calendar entry. They will still be sent to your email.",
|
||||||
"opt_in_booking": "Opt-in Booking",
|
"opt_in_booking": "Opt-in Booking",
|
||||||
"opt_in_booking_description": "The booking needs to be manually confirmed before it is pushed to the integrations and a confirmation mail is sent.",
|
"opt_in_booking_description": "The booking needs to be manually confirmed before it is pushed to the integrations and a confirmation mail is sent.",
|
||||||
"disable_guests": "Disable Guests",
|
"disable_guests": "Disable Guests",
|
||||||
|
|
|
@ -102,12 +102,17 @@ export const createEvent = async (credential: Credential, calEvent: CalendarEven
|
||||||
const calendar = getCalendar(credential);
|
const calendar = getCalendar(credential);
|
||||||
let success = true;
|
let success = true;
|
||||||
|
|
||||||
|
// Check if the disabledNotes flag is set to true
|
||||||
|
if (calEvent.hideCalendarNotes) {
|
||||||
|
calEvent.description = "Notes have been hidden by the organiser"; // TODO: i18n this string?
|
||||||
|
}
|
||||||
|
|
||||||
const creationResult = calendar
|
const creationResult = calendar
|
||||||
? await calendar.createEvent(calEvent).catch((e) => {
|
? await calendar.createEvent(calEvent).catch((e) => {
|
||||||
log.error("createEvent failed", e, calEvent);
|
log.error("createEvent failed", e, calEvent);
|
||||||
success = false;
|
success = false;
|
||||||
return undefined;
|
return undefined;
|
||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -131,10 +136,10 @@ export const updateEvent = async (
|
||||||
const updatedResult =
|
const updatedResult =
|
||||||
calendar && bookingRefUid
|
calendar && bookingRefUid
|
||||||
? await calendar.updateEvent(bookingRefUid, calEvent).catch((e) => {
|
? await calendar.updateEvent(bookingRefUid, calEvent).catch((e) => {
|
||||||
log.error("updateEvent failed", e, calEvent);
|
log.error("updateEvent failed", e, calEvent);
|
||||||
success = false;
|
success = false;
|
||||||
return undefined;
|
return undefined;
|
||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "EventType" ADD COLUMN "hideCalendarNotes" BOOLEAN NOT NULL DEFAULT false;
|
|
@ -58,6 +58,7 @@ model EventType {
|
||||||
periodCountCalendarDays Boolean?
|
periodCountCalendarDays Boolean?
|
||||||
requiresConfirmation Boolean @default(false)
|
requiresConfirmation Boolean @default(false)
|
||||||
disableGuests Boolean @default(false)
|
disableGuests Boolean @default(false)
|
||||||
|
hideCalendarNotes Boolean @default(false)
|
||||||
minimumBookingNotice Int @default(120)
|
minimumBookingNotice Int @default(120)
|
||||||
beforeEventBuffer Int @default(0)
|
beforeEventBuffer Int @default(0)
|
||||||
afterEventBuffer Int @default(0)
|
afterEventBuffer Int @default(0)
|
||||||
|
|
1
packages/types/Calendar.d.ts
vendored
1
packages/types/Calendar.d.ts
vendored
|
@ -91,6 +91,7 @@ export interface CalendarEvent {
|
||||||
destinationCalendar?: DestinationCalendar | null;
|
destinationCalendar?: DestinationCalendar | null;
|
||||||
cancellationReason?: string | null;
|
cancellationReason?: string | null;
|
||||||
rejectionReason?: string | null;
|
rejectionReason?: string | null;
|
||||||
|
hideCalendarNotes?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EntryPoint {
|
export interface EntryPoint {
|
||||||
|
|
Loading…
Reference in a new issue