fix: [Server] only push events/sightings when selected

pull/6310/head
Richard van den Berg 2020-09-11 18:08:57 +02:00
parent 80fa3bd416
commit 284f32ba6a
2 changed files with 8 additions and 3 deletions

View File

@ -2335,7 +2335,7 @@ class Event extends AppModel
$event['ShadowAttribute'] = $this->Feed->attachFeedCorrelations($event['ShadowAttribute'], $user, $event['Event'], $overrideLimit, 'Server');
}
}
if (empty($options['metadata'])) {
if (empty($options['metadata']) && empty($options['noSightings'])) {
$this->Sighting = ClassRegistry::init('Sighting');
$event['Sighting'] = $this->Sighting->attachToEvent($event, $user);
}

View File

@ -2933,8 +2933,8 @@ class Server extends AppModel
return $push;
}
// sync events if user is capable
if ($push['canPush']) {
// sync events if user is capable and server is configured for push
if ($push['canPush'] && $server['Server']['push']) {
if ("full" == $technique) {
$eventid_conditions_key = 'Event.id >';
$eventid_conditions_value = 0;
@ -3006,6 +3006,11 @@ class Server extends AppModel
'deleted' => array(0,1),
'excludeGalaxy' => 1
));
if (empty($server['Server']['push_sightings'])) {
$params = array_merge($params, array(
'noSightings' => 1
));
}
$event = $this->Event->fetchEvent($user, $params);
$event = $event[0];
$event['Event']['locked'] = 1;