From eddfe0389047ac1df5a8194d36c3bde1fcc05866 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Mon, 30 Sep 2019 13:29:32 +0100 Subject: Event group functionality --- views/partials/importeventform.handlebars | 1 + 1 file changed, 1 insertion(+) (limited to 'views/partials/importeventform.handlebars') diff --git a/views/partials/importeventform.handlebars b/views/partials/importeventform.handlebars index 35baf6e..7bf5b17 100644 --- a/views/partials/importeventform.handlebars +++ b/views/partials/importeventform.handlebars @@ -1,3 +1,4 @@ +

Import an existing event

Upload an .ics file here to instantly create an event. You can save a Facebook event as an .ics file by clicking on the context menu next to the 'Import' and 'Edit' buttons on the event page and choosing the 'Export Event' option. Then select the 'Save to calendar' option and save the file on your computer.

-- cgit v1.2.3 From 40ade71e0019bbb59710a2e2e5d74197c47cb1b0 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Mon, 30 Sep 2019 13:57:28 +0100 Subject: Fixes to iCal parser --- public/js/generate-timezones.js | 3 ++- routes.js | 17 +++++++++++++---- views/partials/editeventgroupmodal.handlebars | 4 ++-- views/partials/editeventmodal.handlebars | 6 +++--- views/partials/importeventform.handlebars | 11 ++++++++++- views/partials/neweventform.handlebars | 4 ++-- views/partials/neweventgroupform.handlebars | 2 +- 7 files changed, 33 insertions(+), 14 deletions(-) (limited to 'views/partials/importeventform.handlebars') diff --git a/public/js/generate-timezones.js b/public/js/generate-timezones.js index 2c7cbf9..01c9989 100644 --- a/public/js/generate-timezones.js +++ b/public/js/generate-timezones.js @@ -343,7 +343,8 @@ const timezones = [ "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Wake", - "Pacific/Wallis" + "Pacific/Wallis", + "Etc/UTC" ]; const dateTimeUtc = moment().utc(); diff --git a/routes.js b/routes.js index 80014e5..ee723e2 100755 --- a/routes.js +++ b/routes.js @@ -505,9 +505,18 @@ router.post('/importevent', (req, res) => { if (req.files && Object.keys(req.files).length != 0) { importediCalObject = ical.parseICS(req.files.icsImportControl.data.toString('utf8')); for (var key in importediCalObject) { - importedEventData = importediCalObject[key]; + importedEventData = importediCalObject[key]; } - creatorEmail = importedEventData.organizer.val.replace("MAILTO:", "") + console.log(importedEventData) + let creatorEmail; + if (req.body.creatorEmail) { + creatorEmail = req.body.creatorEmail + } else if (importedEventData.organizer) { + creatorEmail = importedEventData.organizer.val.replace("MAILTO:", ""); + } else { + res.status(500).send("Please supply an email address on the previous page."); + } + const event = new Event({ id: eventID, type: 'public', @@ -515,12 +524,12 @@ router.post('/importevent', (req, res) => { location: importedEventData.location, start: importedEventData.start, end: importedEventData.end, - timezone: importedEventData.start.tz, + timezone: typeof importedEventData.start.tz != 'undefined' ? importedEventData.start.tz : "Etc/UTC", description: importedEventData.description, image: '', creatorEmail: creatorEmail, url: '', - hostName: importedEventData.organizer.params.CN, + hostName: importedEventData.organizer ? importedEventData.organizer.params.CN : "", viewPassword: '', editPassword: '', editToken: editToken, diff --git a/views/partials/editeventgroupmodal.handlebars b/views/partials/editeventgroupmodal.handlebars index 7ab1221..64fba9b 100644 --- a/views/partials/editeventgroupmodal.handlebars +++ b/views/partials/editeventgroupmodal.handlebars @@ -11,7 +11,7 @@