Make filter mutator API consistent with search mutator API.

This is inline with the docblock for the Filter extender, and is much more sensible.
This commit is contained in:
Alexander Skvortsov 2021-03-11 23:12:49 -05:00
parent 6c4867d547
commit 99311188a2
2 changed files with 5 additions and 5 deletions

View File

@ -77,7 +77,7 @@ abstract class AbstractFilterer
// END DEPRECATED BC LAYER
foreach ($this->filterMutators as $mutator) {
$mutator($query, $actor, $criteria->query, $criteria->sort);
$mutator($filterState, $criteria);
}
// Execute the filter query and retrieve the results. We get one more

View File

@ -84,8 +84,8 @@ class FilterTest extends TestCase
*/
public function filter_mutator_has_effect_if_added()
{
$this->extend((new Extend\Filter(DiscussionFilterer::class))->addFilterMutator(function ($query, $actor, $filters, $sort) {
$query->getQuery()->whereRaw('1=0');
$this->extend((new Extend\Filter(DiscussionFilterer::class))->addFilterMutator(function ($filterState, $criteria) {
$filterState->getQuery()->whereRaw('1=0');
}));
$this->prepDb();
@ -127,8 +127,8 @@ class NoResultFilter implements FilterInterface
class CustomFilterMutator
{
public function __invoke($query, $actor, $filters, $sort)
public function __invoke($filterState, $criteria)
{
$query->getQuery()->whereRaw('1=0');
$filterState->getQuery()->whereRaw('1=0');
}
}