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:
sean-brydon 2022-03-28 19:07:13 +01:00 committed by GitHub
parent 4f1a380969
commit bd66ca183f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 9 deletions

View File

@ -232,6 +232,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
currency: true,
metadata: 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.
/** For team events, we will need to handle each member destinationCalendar eventually */
destinationCalendar: eventType.destinationCalendar || users[0].destinationCalendar,
hideCalendarNotes: eventType.hideCalendarNotes,
};
if (eventType.schedulingType === SchedulingType.COLLECTIVE) {

View File

@ -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]"}}

View File

@ -566,6 +566,8 @@
"type": "Type",
"edit": "Edit",
"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_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",

View File

@ -102,12 +102,17 @@ export const createEvent = async (credential: Credential, calEvent: CalendarEven
const calendar = getCalendar(credential);
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
? await calendar.createEvent(calEvent).catch((e) => {
log.error("createEvent failed", e, calEvent);
success = false;
return undefined;
})
log.error("createEvent failed", e, calEvent);
success = false;
return undefined;
})
: undefined;
return {
@ -131,10 +136,10 @@ export const updateEvent = async (
const updatedResult =
calendar && bookingRefUid
? await calendar.updateEvent(bookingRefUid, calEvent).catch((e) => {
log.error("updateEvent failed", e, calEvent);
success = false;
return undefined;
})
log.error("updateEvent failed", e, calEvent);
success = false;
return undefined;
})
: undefined;
return {

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "EventType" ADD COLUMN "hideCalendarNotes" BOOLEAN NOT NULL DEFAULT false;

View File

@ -58,6 +58,7 @@ model EventType {
periodCountCalendarDays Boolean?
requiresConfirmation Boolean @default(false)
disableGuests Boolean @default(false)
hideCalendarNotes Boolean @default(false)
minimumBookingNotice Int @default(120)
beforeEventBuffer Int @default(0)
afterEventBuffer Int @default(0)

View File

@ -91,6 +91,7 @@ export interface CalendarEvent {
destinationCalendar?: DestinationCalendar | null;
cancellationReason?: string | null;
rejectionReason?: string | null;
hideCalendarNotes?: boolean;
}
export interface EntryPoint {