Fix misleading warning when editing/deleting a shared event (T1357)

and properly notify attendees of such a change.

Conflicts:
	plugins/libcalendaring/libvcalendar.php
This commit is contained in:
Aleksander Machniak 2017-04-04 12:17:17 +02:00
parent 02bae9b072
commit acc49b51ff
3 changed files with 41 additions and 15 deletions

View file

@ -2558,7 +2558,15 @@ function rcube_calendar_ui(settings)
if (_has_attendees) {
var checked = (settings.itip_notify & 1 ? ' checked="checked"' : '');
if (_is_organizer) {
if (action == 'remove' && cal.group == 'personal' && is_attendee(event)) {
decline = true;
checked = event.status != 'CANCELLED' ? checked : '';
html += '<div class="message">' +
'<label><input class="confirm-attendees-decline" type="checkbox"' + checked + ' value="1" name="decline" />&nbsp;' +
rcmail.gettext('itipdeclineevent', 'calendar') +
'</label></div>';
}
else {
notify = true;
if (settings.itip_notify & 2) {
html += '<div class="message">' +
@ -2570,17 +2578,6 @@ function rcube_calendar_ui(settings)
data._notify = settings.itip_notify;
}
}
else if (action == 'remove' && is_attendee(event)) {
decline = true;
checked = event.status != 'CANCELLED' ? checked : '';
html += '<div class="message">' +
'<label><input class="confirm-attendees-decline" type="checkbox"' + checked + ' value="1" name="decline" />&nbsp;' +
rcmail.gettext('itipdeclineevent', 'calendar') +
'</label></div>';
}
else {
html += '<div class="message">' + rcmail.gettext('localchangeswarning', 'calendar') + '</div>';
}
}
// recurring event: user needs to select the savemode

View file

@ -261,6 +261,21 @@ class libcalendaring_itip
}
}
// Set SENT-BY property if the sender is not the organizer
if ($method == 'CANCEL' || $method == 'REQUEST') {
foreach ((array)$event['attendees'] as $idx => $attendee) {
if ($attendee['role'] == 'ORGANIZER'
&& $attendee['email']
&& strcasecmp($attendee['email'], $from) != 0
&& strcasecmp($attendee['email'], $from_utf) != 0
) {
$attendee['sent-by'] = 'mailto:' . $from_utf;
$event['organizer'] = $event['attendees'][$idx] = $attendee;
break;
}
}
}
// compose multipart message using PEAR:Mail_Mime
$message = new Mail_mime("\r\n");
$message->setParam('text_encoding', 'quoted-printable');

View file

@ -43,8 +43,22 @@ class libvcalendar implements Iterator
private $attach_uri = null;
private $prodid = '-//Roundcube libcalendaring//Sabre//Sabre VObject//EN';
private $type_component_map = array('event' => 'VEVENT', 'task' => 'VTODO');
private $attendee_keymap = array('name' => 'CN', 'status' => 'PARTSTAT', 'role' => 'ROLE',
'cutype' => 'CUTYPE', 'rsvp' => 'RSVP', 'delegated-from' => 'DELEGATED-FROM', 'delegated-to' => 'DELEGATED-TO');
private $attendee_keymap = array(
'name' => 'CN',
'status' => 'PARTSTAT',
'role' => 'ROLE',
'cutype' => 'CUTYPE',
'rsvp' => 'RSVP',
'delegated-from' => 'DELEGATED-FROM',
'delegated-to' => 'DELEGATED-TO',
'schedule-status' => 'SCHEDULE-STATUS',
'sent-by' => 'SENT-BY',
);
private $organizer_keymap = array(
'name' => 'CN',
'schedule-status' => 'SCHEDULE-STATUS',
'sent-by' => 'SENT-BY',
);
private $iteratorkey = 0;
private $charset;
private $forward_exceptions;
@ -1139,7 +1153,7 @@ class libvcalendar implements Iterator
if ($event['organizer']) {
$ve->add('ORGANIZER', 'mailto:' . $event['organizer']['email'],
array_filter(self::map_keys($event['organizer'], array('name' => 'CN'))));
array_filter(self::map_keys($event['organizer'], $this->organizer_keymap)));
}
foreach ((array)$event['url'] as $url) {