From 045a336a2f6ddd40a9bb9b692b2f98a95ca01360 Mon Sep 17 00:00:00 2001 From: Effy Elden Date: Thu, 1 Jun 2023 12:03:04 +1000 Subject: [PATCH 1/2] Don't sync declined events --- SyncCalendarsIntoOne.gs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SyncCalendarsIntoOne.gs b/SyncCalendarsIntoOne.gs index 1bb75b9..8b9e465 100644 --- a/SyncCalendarsIntoOne.gs +++ b/SyncCalendarsIntoOne.gs @@ -111,6 +111,11 @@ function createEvents(startTime, endTime) { if (event.transparency && event.transparency === "transparent") { return } + + // Don't copy declined events. + if (event.attendees && event.attendees.find((at) => at.self) && event.attendees.find((at) => at.self)['responseStatus'] == 'declined') { + return + } // If event.summary is undefined, empty, or null, set it to default title if (!event.summary || event.summary === "") { From 0383bfbc60dbdc69c2064d54a42af870098b6983 Mon Sep 17 00:00:00 2001 From: Ali Karbassi Date: Thu, 1 Jun 2023 16:59:12 -0500 Subject: [PATCH 2/2] Add 'DO_NOT_SYNC_DECLINED' flag --- SyncCalendarsIntoOne.gs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SyncCalendarsIntoOne.gs b/SyncCalendarsIntoOne.gs index 8b9e465..b41d838 100644 --- a/SyncCalendarsIntoOne.gs +++ b/SyncCalendarsIntoOne.gs @@ -21,6 +21,9 @@ const DEFAULT_EVENT_TITLE = "Busy" // https://unicode-table.com/en/200B/ const SEARCH_CHARACTER = "\u200B" +// Do not sync declined events. Default: false (do sync) +const DO_NOT_SYNC_DECLINED = false + // ---------------------------------------------------------------------------- // DO NOT TOUCH FROM HERE ON // ---------------------------------------------------------------------------- @@ -113,7 +116,7 @@ function createEvents(startTime, endTime) { } // Don't copy declined events. - if (event.attendees && event.attendees.find((at) => at.self) && event.attendees.find((at) => at.self)['responseStatus'] == 'declined') { + if (DO_NOT_SYNC_DECLINED && event.attendees && event.attendees.find((at) => at.self) && event.attendees.find((at) => at.self)['responseStatus'] == 'declined') { return }