Fix iTip replies to organizer (don't increment sequence if I'm not the owner)

This commit is contained in:
Thomas Bruederli 2014-07-31 12:49:27 +02:00
parent f8b6706074
commit f5e93184e3
4 changed files with 28 additions and 13 deletions

View file

@ -902,9 +902,15 @@ class tasklist_kolab_driver extends tasklist_driver
unset($object['attachments']);
}
$object['_owner'] = $identity['email'];
// allow sequence increments if I'm the organizer
if ($this->plugin->is_organizer($object)) {
unset($object['sequence']);
}
else if (isset($old['sequence'])) {
$object['sequence'] = $old['sequence'];
}
unset($object['tempid'], $object['raw'], $object['list'], $object['flagged'], $object['tags'], $object['sequence']);
unset($object['tempid'], $object['raw'], $object['list'], $object['flagged'], $object['tags']);
return $object;
}

View file

@ -949,10 +949,11 @@ a.morelink:hover {
display: block;
color: #333;
font-weight: bold;
padding: 8px 4px 3px 30px;
padding: 3px 4px 3px 30px;
text-shadow: 0px 1px 1px #fff;
text-decoration: none;
white-space: nowrap;
line-height: 20px;
}
#taskedit-attachments ul li a.file {

View file

@ -992,16 +992,14 @@ function rcube_tasklist_ui(settings)
notify = false, partstat = false, html = '';
// task has attendees, ask whether to notify them
if (has_attendees(rec)) {
if (is_organizer(rec)) {
notify = true;
html = rcmail.gettext('changeconfirmnotifications', 'tasklist');
}
// ask whether to change my partstat and notify organizer
else if (data._status_before !== undefined && data.status && data._status_before != data.status && is_attendee(rec)) {
partstat = true;
html = rcmail.gettext('partstatupdatenotification', 'tasklist');
}
if (has_attendees(rec) && is_organizer(rec)) {
notify = true;
html = rcmail.gettext('changeconfirmnotifications', 'tasklist');
}
// ask whether to change my partstat and notify organizer
else if (data._status_before !== undefined && data.status && data._status_before != data.status && is_attendee(rec)) {
partstat = true;
html = rcmail.gettext('partstatupdatenotification', 'tasklist');
}
// remove to avoid endless recursion

View file

@ -1097,6 +1097,16 @@ class tasklist extends rcube_plugin
return false;
}
/**
* Determine whether the current user is the organizer of the given task
*/
public function is_organizer($task)
{
$emails = $this->lib->get_user_emails();
return (empty($task['organizer']) || in_array(strtolower($task['organizer']['email']), $emails));
}
/******* UI functions ********/
/**