* Calendar/CalDAV: do not report non-participants as busy or conflict

This commit is contained in:
Ralf Becker 2017-08-18 09:49:02 +02:00
parent 3bf20b6398
commit 8dba9967e3
3 changed files with 18 additions and 11 deletions

View File

@ -99,7 +99,7 @@ class calendar_boupdate extends calendar_bo
* @param boolean $ignore_conflicts =false just ignore conflicts or do a conflict check and return the conflicting events * @param boolean $ignore_conflicts =false just ignore conflicts or do a conflict check and return the conflicting events
* @param boolean $touch_modified =true NOT USED ANYMORE (was only used in old csv-import), modified&modifier is always updated! * @param boolean $touch_modified =true NOT USED ANYMORE (was only used in old csv-import), modified&modifier is always updated!
* @param boolean $ignore_acl =false should we ignore the acl * @param boolean $ignore_acl =false should we ignore the acl
* @param boolean $updateTS =true update the content history of the event * @param boolean $updateTS =true update the content history of the event (ignored, as updating timestamps is required for sync!)
* @param array &$messages=null messages about because of missing ACL removed participants or categories * @param array &$messages=null messages about because of missing ACL removed participants or categories
* @param boolean $skip_notification =false true: send NO notifications, default false = send them * @param boolean $skip_notification =false true: send NO notifications, default false = send them
* @return mixed on success: int $cal_id > 0, on error false or array with conflicting events (only if $check_conflicts) * @return mixed on success: int $cal_id > 0, on error false or array with conflicting events (only if $check_conflicts)
@ -118,6 +118,7 @@ class calendar_boupdate extends calendar_bo
*/ */
function update(&$event,$ignore_conflicts=false,$touch_modified=true,$ignore_acl=false,$updateTS=true,&$messages=null, $skip_notification=false) function update(&$event,$ignore_conflicts=false,$touch_modified=true,$ignore_acl=false,$updateTS=true,&$messages=null, $skip_notification=false)
{ {
unset($updateTS); // ignored, as updating timestamps is required for sync!
//error_log(__METHOD__."(".array2string($event).",$ignore_conflicts,$touch_modified,$ignore_acl)"); //error_log(__METHOD__."(".array2string($event).",$ignore_conflicts,$touch_modified,$ignore_acl)");
if (!is_array($messages)) $messages = $messages ? (array)$messages : array(); if (!is_array($messages)) $messages = $messages ? (array)$messages : array();
@ -310,9 +311,9 @@ class calendar_boupdate extends calendar_bo
$quantity = $users = array(); $quantity = $users = array();
foreach($event['participants'] as $uid => $status) foreach($event['participants'] as $uid => $status)
{ {
$q = $r = null; $q = $role = null;
calendar_so::split_status($status,$q,$r); calendar_so::split_status($status, $q, $role);
if ($status[0] == 'R') continue; // ignore rejected participants if ($status == 'R' || $role == 'NON-PARTICIPANT') continue; // ignore rejected or non-participants
if ($uid < 0) // group, check it's members too if ($uid < 0) // group, check it's members too
{ {
@ -396,8 +397,8 @@ class calendar_boupdate extends calendar_bo
foreach($common_parts as $n => $uid) foreach($common_parts as $n => $uid)
{ {
$status = $overlap['participants'][$uid]; $status = $overlap['participants'][$uid];
calendar_so::split_status($status, $q, $r); calendar_so::split_status($status, $q, $role);
if ($status == 'R') if ($status == 'R' || $role == 'NON-PARTICIPANT')
{ {
unset($common_parts[$n]); unset($common_parts[$n]);
continue; continue;
@ -1070,7 +1071,7 @@ class calendar_boupdate extends calendar_bo
) )
)); ));
} }
$notification->set_popupmessage($response."\n\n".$notify_body."\n\n".$details['description']."\n\n".$details_body."\n\n"); $notification->set_popupmessage($subject."\n\n".$notify_body."\n\n".$details['description']."\n\n".$details_body."\n\n");
$notification->set_popuplinks(array($details['link_arr']+array('app'=>'calendar'))); $notification->set_popuplinks(array($details['link_arr']+array('app'=>'calendar')));
if(is_array($attachment)) { $notification->set_attachments(array($attachment)); } if(is_array($attachment)) { $notification->set_attachments(array($attachment)); }

View File

@ -3367,9 +3367,12 @@ class calendar_ical extends calendar_boupdate
{ {
if ($event['non_blocking']) continue; if ($event['non_blocking']) continue;
if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue; if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue;
if ($event['participants'][$user] == 'R') continue; $status = $event['participants'][$user];
$quantity = $role = null;
calendar_so::split_status($status, $quantity, $role);
if ($status == 'R' || $role == 'NON-PARTICIPANT') continue;
$fbtype = $event['participants'][$user] == 'T' ? 'BUSY-TENTATIVE' : 'BUSY'; $fbtype = $status == 'T' ? 'BUSY-TENTATIVE' : 'BUSY';
if ($utc) if ($utc)
{ {

View File

@ -2369,7 +2369,10 @@ class calendar_uiforms extends calendar_ui
$non_rejected_found = false; $non_rejected_found = false;
foreach($participants as $uid) foreach($participants as $uid)
{ {
if ($event['participants'][$uid] == 'R') continue; $status = $event['participants'][$uid];
$quantity = $role = null;
calendar_so::split_status($status, $quantity, $role);
if ($status == 'R' || $role == 'NON-PARTICIPANT') continue;
if (isset($event['participants'][$uid]) || if (isset($event['participants'][$uid]) ||
$uid > 0 && array_intersect(array_keys((array)$event['participants']), $uid > 0 && array_intersect(array_keys((array)$event['participants']),