new: [API] Added publish filter to restsearch

pull/3551/head
iglocska 2018-08-10 17:38:04 +02:00
parent 509d2b103e
commit fe453f23cd
1 changed files with 9 additions and 1 deletions

View File

@ -1298,6 +1298,7 @@ class Event extends AppModel
'publish_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
'org' => array('function' => 'set_filter_org', 'pop' => true),
'uuid' => array('function' => 'set_filter_uuid', 'pop' => true),
'published' => array('function' => 'set_filter_published', 'pop' => true)
),
'Object' => array(
'type' => array('function' => 'set_filter_object_type')
@ -1986,6 +1987,13 @@ class Event extends AppModel
return $conditions;
}
public function set_filter_published(&$params, $conditions, $options) {
if (isset($params['published'])) {
$conditions['AND']['Event.published'] = $params['published'];
}
return $conditions;
}
public function set_filter_tags(&$params, $conditions, $options) {
if (!empty($params['tags'])) {
$conditions = $this->Attribute->set_filter_tags($params, $conditions, $options);
@ -3847,7 +3855,7 @@ class Event extends AppModel
$delta = substr($delta, 0, -1);
} else {
// invalid filter, make sure we don't return anything
return time() + 1;
return time();
}
if (!is_numeric($delta)) {
return false;