Calendar: Fix recurring events that started outside current view were not updated properly in the current view after creating an exception

This commit is contained in:
nathan 2022-09-01 09:03:47 -06:00
parent 138a04bf74
commit d0100cd7a1
2 changed files with 20 additions and 4 deletions

View File

@ -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;
}

View File

@ -631,8 +631,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