Approval queue will trigger unexpected rebuilds when using filters

Xon

Well-known member
Affected version
2.3.6
PHP:
$filters = $this->getQueueFilterInput();
$this->applyQueueFilters($unapprovedFinder, $filters);
...

if ($unapprovedItems->count() != $this->app->unapprovedCounts['total'])
{
    $approvalQueueRepo->rebuildUnapprovedCounts();
}

rebuildUnapprovedCounts will be unexpectedly called because unapprovedItems can be a limited unset of the the full list. Checking conditions on the finder isn't enough as there might be a required joins which are excluding things via a 3rd party add-on.
 
Maybe adding a \XF\Mvc\Entity\Finder::isBasicQuery() method and checking that before checking against unapprovedCounts

PHP:
function isBasicQuery(): bool
{
   return count($this->conditions) === 0 && count($this->joins) === 0;
}
 
Back
Top Bottom