From f79cb7e9898f7a4d2f32d717167fbb481b485fff Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Tue, 1 Dec 2020 10:13:48 +0100 Subject: [PATCH] :zap: Allow multiple attendees in one field in Google Calendar --- .../nodes/Google/Calendar/EventDescription.ts | 4 ++-- .../Google/Calendar/GoogleCalendar.node.ts | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts index 3ed284665..035e8f078 100644 --- a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts +++ b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts @@ -166,7 +166,7 @@ export const eventFields = [ multipleValueButtonText: 'Add Attendee', }, default: '', - description: 'The attendees of the event', + description: 'The attendees of the event. Multiple ones can be separated by comma.', }, { displayName: 'Color', @@ -810,7 +810,7 @@ export const eventFields = [ multipleValueButtonText: 'Add Attendee', }, default: '', - description: 'The attendees of the event', + description: 'The attendees of the event. Multiple ones can be separated by comma.', }, { displayName: 'Color', diff --git a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts index 597276d17..803446de9 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts @@ -259,11 +259,10 @@ export class GoogleCalendar implements INodeType { }, }; if (additionalFields.attendees) { - body.attendees = (additionalFields.attendees as string[]).map( - attendee => { - return { email: attendee }; - }, - ); + body.attendees = []; + (additionalFields.attendees as string[]).forEach(attendee => { + body.attendees!.push.apply(body.attendees, attendee.split(',').map(a => a.trim()).map(email => ({ email }))); + }); } if (additionalFields.color) { body.colorId = additionalFields.color as string; @@ -504,11 +503,10 @@ export class GoogleCalendar implements INodeType { }; } if (updateFields.attendees) { - body.attendees = (updateFields.attendees as string[]).map( - attendee => { - return { email: attendee }; - }, - ); + body.attendees = []; + (updateFields.attendees as string[]).forEach(attendee => { + body.attendees!.push.apply(body.attendees, attendee.split(',').map(a => a.trim()).map(email => ({ email }))); + }); } if (updateFields.color) { body.colorId = updateFields.color as string;