fix not displayed event-participants in new meeting-requests (event not yet in DB)

This commit is contained in:
ralf 2024-08-09 10:58:02 +02:00
parent 09153c0074
commit 59a1836842

View File

@ -2243,19 +2243,6 @@ class calendar_uiforms extends calendar_ui
{ {
$master = $this->bo->read($event['uid']); $master = $this->bo->read($event['uid']);
} }
$all_participants = ($event['participants'] ?? []) + ($existing_event['participants'] ?? []);
$event['participantChanges'] = array_map(function($uid, $status) use ($existing_event, $event) {
return [
'changed' => !isset($event['participants'][$uid]) ? 'meetingRequestParticipantDeleted' :
(!isset($existing_event['participants'][$uid]) ? 'meetingRequestChanged' :
($status !== $existing_event['participants'][$uid] ? 'meetingRequestChangedStatus' : '')),
'label' => $this->bo->participant_name($uid),
'status' => lang($this->bo->verbose_status[calendar_so::split_status($status, $quantity, $role)]),
'role' => $role === 'REQ-PARTICIPANT' ? '' : lang($this->bo->roles[$role] ??
(substr($role,0,6) === 'X-CAT-' && ($cat_id = (int)substr($role,6)) > 0 ?
$GLOBALS['egw']->categories->id2name($cat_id) : str_replace('X-','',$role))),
];
}, array_keys($all_participants), $all_participants);
switch(strtolower($ical_method)) switch(strtolower($ical_method))
{ {
@ -2370,14 +2357,19 @@ class calendar_uiforms extends calendar_ui
{ {
$readonlys['button[cancel]'] = true; // no way to remove a canceled event not in calendar $readonlys['button[cancel]'] = true; // no way to remove a canceled event not in calendar
} }
$event['participant_types'] = array(); $all_participants = ($event['participants'] ?? []) + ($existing_event['participants'] ?? []);
foreach($event['participants'] as $uid => $status) $event['participantChanges'] = array_map(function($uid, $status) use ($existing_event, $event) {
{ return [
$user_type = $user_id = null; 'changed' => !isset($event['participants'][$uid]) ? 'meetingRequestParticipantDeleted' :
calendar_so::split_user($uid, $user_type, $user_id); (!isset($existing_event) ? '' : (!isset($existing_event['participants'][$uid]) ? 'meetingRequestChanged' :
$event['participants'][$uid] = $event['participant_types'][$user_type][$user_id] = ($status !== $existing_event['participants'][$uid] ? 'meetingRequestChangedStatus' : ''))),
$status && $status !== 'X' ? $status : 'U'; // X --> no status given --> U = unknown 'label' => $this->bo->participant_name($uid),
} 'status' => lang($this->bo->verbose_status[calendar_so::split_status($status, $quantity, $role)]),
'role' => $role === 'REQ-PARTICIPANT' ? '' : lang($this->bo->roles[$role] ??
(substr($role,0,6) === 'X-CAT-' && ($cat_id = (int)substr($role,6)) > 0 ?
$GLOBALS['egw']->categories->id2name($cat_id) : str_replace('X-','',$role))),
];
}, array_keys($all_participants), $all_participants);
//error_log(__METHOD__."(...) parsed as ".array2string($event)); //error_log(__METHOD__."(...) parsed as ".array2string($event));
$event['recure'] = $this->bo->recure2string($master ?? null ?: $event); $event['recure'] = $this->bo->recure2string($master ?? null ?: $event);
if (!empty($master)) unset($event['changed']['recure']); if (!empty($master)) unset($event['changed']['recure']);