* Calendar/CalDAV: fix yearly recurring events stalling sync

also fixed PHP Warning about array_intersect parameter 2 not being an array
This commit is contained in:
Ralf Becker 2019-01-21 12:55:18 +01:00
parent b15e3c8372
commit ff17f34e30

View File

@ -797,7 +797,8 @@ class calendar_groupdav extends Api\CalDAV\Handler
// not for included exceptions (Lightning): $master['recur_exception'][] = $recurrence['start']; // not for included exceptions (Lightning): $master['recur_exception'][] = $recurrence['start'];
} }
// only add master if we are not expanding and current user participates in master (and not just some exceptions) // only add master if we are not expanding and current user participates in master (and not just some exceptions)
if (!$expand && $master && (!$user || self::isParticipant($master, $user))) // also need to add master, if we have no (other) $events eg. birthday noone every accepted/rejected
if (!$expand && $master && (!$user || self::isParticipant($master, $user) || !$events))
{ {
$events = array_merge(array($master), $events); $events = array_merge(array($master), $events);
} }
@ -814,8 +815,9 @@ class calendar_groupdav extends Api\CalDAV\Handler
public static function isParticipant(array $event, $user) public static function isParticipant(array $event, $user)
{ {
return isset($event['participants'][$user]) || return isset($event['participants'][$user]) ||
// for group-invitations we need to check memberships of $user too // for users and group-invitations we need to check memberships of $user too
array_intersect(array_keys($event['participants']), $GLOBALS['egw']->accounts->memberships($user, true)); $user > 0 && array_intersect(array_keys($event['participants']),
(array)$GLOBALS['egw']->accounts->memberships($user, true));
} }
/** /**