Skip to content

Commit

Permalink
Fixes for sending iTips in various cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Feb 4, 2016
1 parent 1561356 commit 1b37ba1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kronolith/lib/Ajax/Application/Handler.php
Expand Up @@ -387,7 +387,9 @@ public function saveEvent()
$event->save();
}
}
if (!$event->organizer || Kronolith::isUserEmail($this->creator, $event->organizer)) {

// Only the ORGANIZER's copy should trigger a REQUEST or CANCEL.
if (empty($event->organizer)) {
$type = $event->status == Kronolith::STATUS_CANCELLED
? Kronolith::ITIP_CANCEL
: Kronolith::ITIP_REQUEST;
Expand All @@ -398,7 +400,7 @@ public function saveEvent()
// 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)) {
if (empty($event->organizer) && !empty($removed_attendees)) {
$to_cancel = array();
foreach ($removed_attendees as $email) {
$to_cancel[$email] = $old_attendees[$email];
Expand Down
6 changes: 6 additions & 0 deletions kronolith/lib/Kronolith.php
Expand Up @@ -1940,6 +1940,12 @@ public static function sendITipNotifications(
}

foreach ($mail_attendees as $email => $status) {
/* Don't send notifications to the ORGANIZER if this is the
* ORGANIZER's copy of the event. */
if (!$event->organizer && Kronolith::isUserEmail($event->creator, $email)) {
continue;
}

/* 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 1b37ba1

Please sign in to comment.