Skip to content

Commit

Permalink
Bug: 14118 Better handling of CANCEL iTips.
Browse files Browse the repository at this point in the history
If only a subset of attendees are being removed, keep the
new attendee list intact when sending the iTips, but replace
the recipient email addresses with those being removed. This
prevents the users being removed from still appearing in the
attendee list of the UPDATE iTip the remaining attendees receive.
  • Loading branch information
mrubinsk committed Oct 20, 2015
1 parent a276749 commit 720644c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
8 changes: 6 additions & 2 deletions kronolith/lib/Ajax/Application/Handler.php
Expand Up @@ -352,14 +352,18 @@ public function saveEvent()
: Kronolith::ITIP_REQUEST;
Kronolith::sendITipNotifications($event, $notification, $type);
}

// Send a CANCEL iTip for attendees that have been removed, but only if
// the entire event isn't being marked as cancelled (which would be
// caught above).
if (!empty($removed_attendees)) {
$to_cancel = array();
foreach ($removed_attendees as $email) {
$to_cancel[$email] = $old_attendees[$email];
}
$cancelEvent = clone $event;
$cancelEvent->attendees = $to_cancel;
Kronolith::sendITipNotifications(
$cancelEvent, $notification, Kronolith::ITIP_CANCEL
$cancelEvent, $notification, Kronolith::ITIP_CANCEL, null, null, $to_cancel
);
}
Kronolith::notifyOfResourceRejection($event);
Expand Down
17 changes: 14 additions & 3 deletions kronolith/lib/Kronolith.php
Expand Up @@ -1881,10 +1881,17 @@ static public function attendeeList()
* this instance.
* @param string $range The range parameter if this is a recurring event.
* Possible values are self::RANGE_THISANDFUTURE
* @param array $cancellations If $action is 'CANCEL', but it is due to
* removing attendees and not canceling the
* entire event, these are the email addresses
* of the uninvited attendees and are the ONLY
* people that will receive the CANCEL iTIP.
* @since 4.2.10
*
*/
static public function sendITipNotifications(
Kronolith_Event $event, Horde_Notification_Handler $notification,
$action, Horde_Date $instance = null, $range = null)
$action, Horde_Date $instance = null, $range = null, array $cancellations = array())
{
global $injector, $registry;

Expand All @@ -1908,8 +1915,12 @@ static public function sendITipNotifications(
$view->identity = $ident;
$view->event = $event;
$view->imageId = $image->getContentId();

foreach ($event->attendees as $email => $status) {
if ($action == self::ITIP_CANCEL && !empty($cancellations)) {
$mail_attendees = $cancellations;
} else {
$mail_attendees = $event->attendees;
}
foreach ($mail_attendees as $email => $status) {
/* Don't bother sending an invitation/update if the recipient does
* not need to participate, or has declined participating, or
* doesn't have an email address. */
Expand Down

0 comments on commit 720644c

Please sign in to comment.