diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index f21e6f17..58d35787 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -2032,17 +2032,28 @@ class calendar extends rcube_plugin $event['attendees'][$i]['rsvp'] = $attendee['rsvp'] == 'true' || $attendee['rsvp'] == '1'; } + if (!empty($event['_identity'])) { + $identity = $this->rc->user->get_identity($event['_identity']); + } + // set new organizer identity - if ($organizer !== false && !empty($event['_identity']) && ($identity = $this->rc->user->get_identity($event['_identity']))) { + if ($organizer !== false && $identity) { $event['attendees'][$organizer]['name'] = $identity['name']; $event['attendees'][$organizer]['email'] = $identity['email']; } - // set owner as organizer if yet missing - if ($organizer === false && $owner !== false) { + else if ($organizer === false && $owner !== false) { $event['attendees'][$owner]['role'] = 'ORGANIZER'; unset($event['attendees'][$owner]['rsvp']); } + // fallback to the selected identity + else if ($organizer === false && $identity) { + $event['attendees'][] = array( + 'role' => 'ORGANIZER', + 'name' => $identity['name'], + 'email' => $identity['email'], + ); + } } // mapping url => vurl because of the fullcalendar client script diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js index 00ad9171..3fcfd629 100644 --- a/plugins/calendar/calendar_ui.js +++ b/plugins/calendar/calendar_ui.js @@ -905,13 +905,9 @@ function rcube_calendar_ui(settings) if (data.attendees[i]) data.attendees[i].role = $(elem).val(); }); - + if (organizer) data._identity = $('#edit-identities-list option:selected').val(); - - // don't submit attendees if only myself is added as organizer - if (data.attendees.length == 1 && data.attendees[0].role == 'ORGANIZER' && String(data.attendees[0].email).toLowerCase() == settings.identity.email) - data.attendees = []; // per-attendee notification suppression var need_invitation = false;