Calendar: Move check to reset participant status out of UI into BO so it's always checked

This commit is contained in:
nathangray 2020-05-19 10:44:56 -06:00
parent 49dbd89afb
commit dc1518c8d4
4 changed files with 5 additions and 18 deletions

View File

@ -245,9 +245,6 @@ class calendar_boupdate extends calendar_bo
return $conflicts;
}
// See if we need to reset any participant statuses
$this->check_reset_stati($event, $old_event);
// generate a video-room-url, if we need one and not already have one
if ($event['videoconference'] && empty($event['##videoconference']) && class_exists('EGroupware\\Status\\Videoconference\\Call'))
{
@ -1306,6 +1303,8 @@ class calendar_boupdate extends calendar_bo
}
if (!isset($event['whole_day'])) $event['whole_day'] = $this->isWholeDay($event);
$this->check_reset_statuses($event, $old_event);
// set recur-enddate/range-end to real end-date of last recurrence
if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'])
{
@ -3011,7 +3010,7 @@ class calendar_boupdate extends calendar_bo
*
* @return boolean true if any statuses were reset
*/
protected function check_reset_stati(&$event, $old_event)
protected function check_reset_statuses(&$event, $old_event)
{
if(!$old_event || !is_array($old_event) || $event['start'] == $old_event['start'])
{

View File

@ -3121,18 +3121,6 @@ class calendar_uiforms extends calendar_ui
$response->call('egw.message', implode('<br />', $message));
}
if($event['id'] != $eventId ) $this->update_client($_eventId);
if ($status_reset_to_unknown)
{
foreach((array)$event['participants'] as $uid => $status)
{
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user)
{
calendar_so::split_status($status,$q,$r);
$status = calendar_so::combine_status('U',$q,$r);
$this->bo->set_status($event['id'], $uid, $status, 0, true);
}
}
}
}
/**

View File

@ -71,7 +71,7 @@ class ImportParticipantsTest extends \EGroupware\Api\AppTest
$record = new ParticipantRecord($test_string);
// Parse the string
$parsed = $this->parse_method->invokeArgs($this->import, array($record, &$warning));
$parsed = $this->parse_method->invokeArgs($this->import, array($record, &$warning));
// Get numeric ID for this system
foreach ($expected as $id => $status)

View File

@ -43,7 +43,7 @@ class ResetParticipantStatusTest extends \EGroupware\Api\AppTest
// Make check_reset_status method accessable
$class = new \ReflectionClass($this->bo);
$this->check_method = $class->getMethod('check_reset_stati');
$this->check_method = $class->getMethod('check_reset_statuses');
$this->check_method->setAccessible(true);
}