Skip to content

Commit

Permalink
fix: ensure all extensions calls are made to canIndex()
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Feb 10, 2022
1 parent f786648 commit c8f47ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Jobs/AlgoliaIndexItemJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function process()

if (!$obj) {
$this->addMessage('Record #'. $id . ' not found');
} elseif (!$obj->canIndexInAlgolia()) {
} elseif (min($obj->invokeWithExtensions('canIndexInAlgolia')) === false) {
$this->addMessage('Record #'. $id .' not indexed, canIndexInAlgolia returned false');
} else {
if (!$obj->AlgoliaUUID) {
Expand Down
4 changes: 2 additions & 2 deletions src/Tasks/AlgoliaReindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function indexItem($obj = null): bool
{
if (!$obj) {
return false;
} elseif (!$obj->canIndexInAlgolia()) {
} elseif (min($obj->invokeWithExtensions('canIndexInAlgolia')) === false) {
return false;
} else {
if (!$obj->AlgoliaUUID) {
Expand Down Expand Up @@ -208,7 +208,7 @@ public function indexItems($targetClass, $filter = '', $items = null, $output =
// fetch the actual instance
$instance = DataObject::get_by_id($item->ClassName, $item->ID);

if (!$instance || !$instance->canIndexInAlgolia()) {
if (!$instance || min($instance->invokeWithExtensions('canIndexInAlgolia')) == false) {
$skipped++;

continue;
Expand Down

0 comments on commit c8f47ac

Please sign in to comment.