fix: [sync] Issue with events not updating on a pull

- overzealous protection removed
- Conditions blocking an event edit via a pull now rely on the locking mechanism, relaxed via an internal sync link
pull/3941/head
iglocska 2018-12-12 15:58:36 +01:00
parent 2aef86abf1
commit c7a4b6f1f5
1 changed files with 10 additions and 8 deletions

View File

@ -1902,15 +1902,17 @@ class Server extends AppModel
$fails[$eventId] = 'Failed (partially?) because of validation errors: '. json_encode($eventModel->validationErrors, true);
}
} else {
$tempUser = $user;
$tempUser['Role']['perm_site_admin'] = 0;
$result = $eventModel->_edit($event, $tempUser, $existingEvent['Event']['id'], $jobId, $passAlong);
if ($result === true) {
$successes[] = $eventId;
} elseif (isset($result['error'])) {
$fails[$eventId] = $result['error'];
if (!$existingEvent['Event']['locked'] && !$server['Server']['internal']) {
$fails[$eventId] = __('Blocked an edit to an event that was created locally. This can happen if a synchronised event that was created on this instance was modified by an administrator on the remote side.');
} else {
$fails[$eventId] = json_encode($result);
$result = $eventModel->_edit($event, $user, $existingEvent['Event']['id'], $jobId, $passAlong);
if ($result === true) {
$successes[] = $eventId;
} elseif (isset($result['error'])) {
$fails[$eventId] = $result['error'];
} else {
$fails[$eventId] = json_encode($result);
}
}
}
}