Skip to content

Commit

Permalink
Fix for 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Rias committed Jul 12, 2019
1 parent 27b701d commit 10424f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 1.3.0 - 2019-07-12
- Now requires Craft 3.2
- Added a fix for Element drafts & revisions in Craft 3.2

## 1.2.3 - 2019-06-14
- Revert untested change

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-RC1",
"craftcms/cms": "^3.2.0",
"algolia/algoliasearch-client-php": "^2.2.3",
"league/fractal": "^0.18.0"
},
Expand Down
8 changes: 8 additions & 0 deletions src/models/AlgoliaIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ public function transformElement(Element $element)
public function indexElements($elements)
{
foreach ($elements as $element) {
if ($element->getIsDraft() || $element->getIsRevision()) {
continue;
}

if ($this->elementType === get_class($element)) {
if ($this->canIndexElement($element)) {
$this->indexElement($element);
Expand All @@ -148,6 +152,10 @@ public function indexElements($elements)
public function deindexElements($elements)
{
foreach ($elements as $element) {
if ($element->getIsDraft() || $element->getIsRevision()) {
continue;
}

if ($this->elementType === get_class($element) && $this->canDeindexElement($element)) {
$this->deindexElement($element);
}
Expand Down

0 comments on commit 10424f1

Please sign in to comment.