From 31634a76f6f21e8414674ec451f7522a5168570b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 1 Oct 2018 11:51:19 +0000 Subject: [PATCH] Fix detecting date/time change in iTip request (Bifrost#T141857) --- .../lib/libcalendaring_itip.php | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php index 68c598e8..1c7c08b6 100644 --- a/plugins/libcalendaring/lib/libcalendaring_itip.php +++ b/plugins/libcalendaring/lib/libcalendaring_itip.php @@ -394,13 +394,6 @@ class libcalendaring_itip break; } } - - // Detect re-sheduling - if (!$latest) { - // FIXME: This is probably to simplistic, or maybe we should just check - // attendee's RSVP flag in the new event? - $rescheduled = $existing['start'] != $event['start'] || $existing['end'] > $event['end']; - } } else { $rsvp = $event['rsvp'] && $this->rc->config->get('calendar_allow_itip_uninvited', true); @@ -426,17 +419,29 @@ class libcalendaring_itip else if (!$existing && !$rsvp) { $action = 'import'; } - else if ($rescheduled) { - $action = 'rsvp'; - } - else if ($status_lc != 'needs-action') { - // check if there are any changes + else { if ($latest) { - $diff = $this->get_itip_diff($event, $existing); - $latest = empty($diff); + $diff = $this->get_itip_diff($event, $existing); + + // Detect re-scheduling + // FIXME: This is probably to simplistic, or maybe we should just check + // attendee's RSVP flag in the new event? + $rescheduled = !empty($diff['start']) || !empty($diff['end']); + unset($diff['start'], $diff['end']); } - $action = !$latest ? 'update' : ''; + if ($rescheduled) { + $action = 'rsvp'; + $latest = false; + } + else if ($status_lc != 'needs-action') { + // check if there are any changes + if ($latest) { + $latest = empty($diff); + } + + $action = !$latest ? 'update' : ''; + } } $html = html::div('rsvp-status ' . $status_lc, $status_text); @@ -568,6 +573,20 @@ class libcalendaring_itip ); } + if ($existing['start'] != $itip['start']) { + $diff['start'] = array( + 'new' => $itip['start'], + 'old' => $existing['start'], + ); + } + + if ($existing['end'] != $itip['end']) { + $diff['end'] = array( + 'new' => $itip['end'], + 'old' => $existing['end'], + ); + } + return $diff; } }