Commit e399b351 authored by Mark Harding's avatar Mark Harding

(chore): improve efficiency of filter check

1 merge request!294epic/post-scheduler
Pipeline #82603091 passed with stages
in 12 minutes and 16 seconds
......@@ -18,6 +18,7 @@ class FilterEntitiesDelegate
/** @var User */
protected $user;
/** @var int */
protected $time;
public function __construct($user, $time, $acl = null)
......@@ -37,10 +38,10 @@ class FilterEntitiesDelegate
return array_values(array_filter($entities, function ($entity) {
$filterByScheduled = false;
if ($this->shouldFilterScheduled($entity->getType())) {
$filterByScheduled = !ACL::_()->write($entity, $this->user)
&& !($entity->getTimeCreated() <= $this->time);
$filterByScheduled = $entity->getTimeCreated() > $this->time
&& !ACL::_()->write($entity, $this->user);
}
return $this->acl->read($entity, $this->user) && !$filterByScheduled;
return !$filterByScheduled && $this->acl->read($entity, $this->user);
}));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment