diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c57733..64c6a0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index 12e9368..d30e5e4 100644 --- a/composer.json +++ b/composer.json @@ -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" }, diff --git a/src/models/AlgoliaIndex.php b/src/models/AlgoliaIndex.php index 651bc74..2d022e2 100644 --- a/src/models/AlgoliaIndex.php +++ b/src/models/AlgoliaIndex.php @@ -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); @@ -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); }