From 64e2fb7c63accbadbfe3ba0e0c5e33143f98ffe6 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 1 Sep 2022 09:03:47 -0600 Subject: [PATCH] Calendar: Fix recurring events that started outside current view were not updated properly in the current view after creating an exception --- calendar/inc/class.calendar_hooks.inc.php | 15 +++++++++++++-- calendar/js/app.ts | 9 +++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index 09910a18aa..218b7be28d 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -84,10 +84,21 @@ class calendar_hooks */ static public function prepareEventPush($event) { - $event = array_intersect_key($event, array_flip(['id','owner','participants','start','end'])); + $send_keys = ['id', 'owner', 'participants', 'start', 'end']; + if($event['recur_type']) + { + // If it's a recurring event, we're only sending the first instance, which may be outside of the current + // view and therefore would be ignored by the client. Include range for additional check. + $send_keys[] = 'range_start'; + $send_keys[] = 'range_end'; + } + $event = array_intersect_key($event, array_flip($send_keys)); foreach($event['participants'] as $uid => $status) { - if ($uid[0] === 'e') unset($event['participants'][$uid]); + if($uid[0] === 'e') + { + unset($event['participants'][$uid]); + } } return $event; } diff --git a/calendar/js/app.ts b/calendar/js/app.ts index a093e3fa6a..9e6253b38a 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -649,8 +649,13 @@ export class CalendarApp extends EgwApp // Check if we're interested by date? if(cal_event.end <= new Date(this.state.first).valueOf() /1000 || cal_event.start > new Date(this.state.last).valueOf()/1000) { - // The event is outside our current view - return; + // The event is outside our current view, but check if it's just one of a recurring event + if(!cal_event.range_end && !cal_event.range_start || + cal_event.range_end <= new Date(this.state.first).valueOf() / 1000 || + cal_event.range_start > new Date(this.state.last).valueOf() / 1000) + { + return; + } } // Do we already have "fresh" data? Most user actions give fresh data in response