Skip to content

Commit

Permalink
Bump to 1.12.1 (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
damcou authored Oct 30, 2019
1 parent 2cfb5a9 commit adf0740
Show file tree
Hide file tree
Showing 80 changed files with 1,325 additions and 317 deletions.
65 changes: 42 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,52 @@ jobs:
docker:
- image: algolia/magento2-circleci:2.3.0

"phpcompatibility":
docker: # run the steps with Docker with PHP 7.2
- image: circleci/php:7.2
steps:
- checkout
- run: sudo composer self-update
- run: composer config http-basic.repo.magento.com ${MAGENTO_AUTH_USERNAME} ${MAGENTO_AUTH_PASSWORD}
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.lock" }}
- composer-v1-
- run: composer install -n --prefer-dist --ignore-platform-reqs --no-progress
- save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
- run:
name: PHPCS PHPCompatibility
command: |
./vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility/PHPCompatibility/
# vendor/ is large and seems to break phpcs, ls+grep+xargs hack is used to send folders to phpcs
ls -d */ | grep -vE 'dev|Test|vendor' | xargs ./vendor/bin/phpcs -p --standard=PHPCompatibility --runtime-set testVersion 7.1- --runtime-set ignore_warnings_on_exit true
"quality-tools":
docker:
- image: algolia/magento2-circleci:2.3.0
working_directory: ~/build_directory/algoliasearch-magento-2
steps:
- checkout
- run:
name: Setting permissions
command: |
sudo chown circleci:circleci ~/.composer/
- restore_cache:
keys:
- composer-v2-{{ checksum "composer.json" }}
- composer-v2-

- run:
name: Prepare environment
command: |
sudo composer self-update
composer config http-basic.'repo.magento.com' ${MAGENTO_AUTH_USERNAME} ${MAGENTO_AUTH_PASSWORD}
composer install -n --prefer-dist --ignore-platform-reqs --no-progress
sudo chown circleci:circleci ~/.composer/
composer global config prefer-stable true
composer global config minimum-stability dev
composer global require algolia/magento2-tools --ignore-platform-reqs
# We have to do this again because we restore the cache above, overwriting the vendor with the original.
cd ~/magento_directory/vendor/algolia
rm -rf algoliasearch-magento-2
cp -R ~/build_directory/algoliasearch-magento-2 ~/magento_directory/vendor/algolia
cd ~/magento_directory
composer dump-autoload
- save_cache:
key: composer-v2-{{ checksum "composer.json" }}
paths:
- vendor
- ~/.composer/vendor
- run:
name: Quality tools
command: |
sudo ~/.composer/vendor/bin/magento2-test ~/magento_directory/vendor/algolia/algoliasearch-magento-2 ~/.composer/vendor/bin/
workflows:
version: 2
build:
jobs:
- "magento-2.2"
- "magento-2.3"
- "phpcompatibility"
- "quality-tools"
3 changes: 0 additions & 3 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
preset: PSR2
finder:
path:
- "code"
30 changes: 0 additions & 30 deletions Block/Adminhtml/BaseAdminTemplate.php

This file was deleted.

3 changes: 3 additions & 0 deletions Block/LandingPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Magento\Cms\Model\Template\FilterProvider;
use Magento\Search\Model\QueryFactory;

/**
* @method int getPageId()
*/
class LandingPage extends Result
{
/** @var FilterProvider */
Expand Down
3 changes: 3 additions & 0 deletions Block/Navigation/Renderer/CategoryRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class CategoryRenderer extends Template implements FilterRendererInterface
/** @var string */
protected $_template = 'Algolia_AlgoliaSearch::layer/filter/category.phtml';

/** @var FilterInterface */
protected $filter;

public function isMultipleSelectEnabled()
{
return false;
Expand Down
3 changes: 3 additions & 0 deletions Block/Navigation/Renderer/DefaultRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class DefaultRenderer extends Template implements FilterRendererInterface
/** @var ConfigHelper */
private $configHelper;

/** @var FilterInterface */
protected $filter;

/**
* Constructor.
*
Expand Down
3 changes: 3 additions & 0 deletions Block/Navigation/Renderer/SliderRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class SliderRenderer extends Template implements FilterRendererInterface
/** @var FormatInterface */
protected $localeFormat;

/** @var FilterInterface */
protected $filter;

/**
*
* @param Context $context
Expand Down
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# CHANGE LOG

## 1.12.1

This release has been made possible thanks to the involvement of the community, with about half of the pull requests merged coming from the Magento ecosystem.

The Magento team at Algolia really wanted to thank our amazing community for its help.
For this release, a big shout out for:

- @DavidLambauer
- @JosephMaxwell
- @peterjaap
- @unicoder88
- @VincentMarmiesse
- @vmalyk

Thanks A LOT for your PRs, we really appreciate!

What this release brings:

### FEATURES
- Add extension notifier (#868)

### UPDATES
- Removed objectManager from ProductHelper (#814) (by @peterjaap)
- Removing the BaseAdminTemplate block (#822)
- Add config warnings for ES and MSI (#889)
- Remove catalog index price update by schedule subscription (#870) (by @unicoder88)
- Added alt attribute for img tags (#896) (by @vmalyk)
- Add "suggest" section modules in composer.json (#898) (by @vmalyk)
- Create replicas if Backend Facet Rendering is enabled (#902) (by @VincentMarmiesse)

### FIXES
- Fixed the dependency list (#843) (by @DavidLambauer)
- Pass set product website_id to load catalogrule prices with enabled customer groups (#853) (by @unicoder88)
- Clean scope code resolver when starting environment emulation (#857) (by @unicoder88)
- Fixing order of setting parameters (#859) (by @JosephMaxwell)
- Fixed Composer requirements and README.md (#884) (by @vmalyk)
- Fix Tier Price calculation (#887)
- Fix autocomplete additional sections link URL (#891)
- Fix errors in code instead ignore in PHPStan (#878) (by @vmalyk)
- Fix product image helper method to return set images (#899)
- Fix version to 1.12.1 for unsubscribe Mview migration (PR #870) (#910) (by @vmalyk)

### TOOLING
- Events tracking (#805)
- chore: fixes styleci configuration (#847)
- chore(ignores-phpstan-fixed-errors): sets reportUnmatchedIgnoredError (#877)
- ci: quality assurance tools (#882)
- Ci/quality tools (#886)
- chore: increases phpstan level to 1 (#892)
- Make changes to pass new Marketplace test expectations (#906)

## 1.12.0

### FEATURES
Expand Down
4 changes: 2 additions & 2 deletions Controller/Adminhtml/Analytics/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Analytics;

use Algolia\AlgoliaSearch\Block\Adminhtml\BaseAdminTemplate;
use Algolia\AlgoliaSearch\ViewModel\Adminhtml\Analytics\Overview;
use Magento\Backend\Block\Template;
use Magento\Framework\DataObject;

class Update extends AbstractAction
Expand All @@ -18,7 +18,7 @@ public function execute()
$layout = $this->layoutFactory->create();

$block = $layout
->createBlock(BaseAdminTemplate::class)
->createBlock(Template::class)
->setData('view_model', $this->_objectManager->create(Overview::class))
->setTemplate('Algolia_AlgoliaSearch::analytics/overview.phtml')
->toHtml();
Expand Down
2 changes: 0 additions & 2 deletions Controller/Adminhtml/Landingpage/Duplicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ private function copyQueryRules($landingPageFromId, $landingPageToId)
$stores[] = $store->getId();
}
}
} else {
$stores[] = $data['store_id'];
}

foreach ($stores as $storeId) {
Expand Down
47 changes: 43 additions & 4 deletions Controller/Adminhtml/Query/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Query;

use Algolia\AlgoliaSearch\Helper\ConfigHelper;
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
use Algolia\AlgoliaSearch\Helper\ProxyHelper;
use Algolia\AlgoliaSearch\Model\ImageUploader;
use Algolia\AlgoliaSearch\Model\QueryFactory;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\Controller\ResultFactory;
Expand All @@ -17,6 +19,16 @@ class Save extends AbstractAction
*/
protected $dataPersistor;

/**
* @var ConfigHelper
*/
protected $configHelper;

/**
* @var ImageUploader
*/
protected $imageUploader;

/**
* PHP Constructor
*
Expand All @@ -27,6 +39,8 @@ class Save extends AbstractAction
* @param ProxyHelper $proxyHelper
* @param StoreManagerInterface $storeManager
* @param DataPersistorInterface $dataPersistor
* @param ConfigHelper $configHelper
* @param ImageUploader $imageUploader
*
* @return Save
*/
Expand All @@ -37,9 +51,13 @@ public function __construct(
MerchandisingHelper $merchandisingHelper,
ProxyHelper $proxyHelper,
StoreManagerInterface $storeManager,
DataPersistorInterface $dataPersistor
DataPersistorInterface $dataPersistor,
ConfigHelper $configHelper,
ImageUploader $imageUploader
) {
$this->dataPersistor = $dataPersistor;
$this->configHelper = $configHelper;
$this->imageUploader = $imageUploader;

parent::__construct(
$context,
Expand Down Expand Up @@ -84,9 +102,6 @@ public function execute()

if (isset($data['banner_image'][0]['name']) && isset($data['banner_image'][0]['tmp_name'])) {
$data['banner_image'] = $data['banner_image'][0]['name'];
$this->imageUploader = \Magento\Framework\App\ObjectManager::getInstance()->get(
'Algolia\AlgoliaSearch\QueryImageUpload'
);
$this->imageUploader->moveFileFromTmp($data['banner_image']);
} elseif (isset($data['banner_image'][0]['image']) && !isset($data['banner_image'][0]['tmp_name'])) {
$data['banner_image'] = $data['banner_image'][0]['image'];
Expand All @@ -97,6 +112,12 @@ public function execute()
$query->setData($data);
$query->setCreatedAt(time());

$storeId = isset($data['store_id']) && $data['store_id'] != 0 ? $data['store_id'] : null;

$this->trackQueryMerchandisingData($query, 'banner_image', 'Uploaded Banner', $storeId);
$this->trackQueryMerchandisingData($query, 'banner_alt', 'Add Alt Text', $storeId);
$this->trackQueryMerchandisingData($query, 'banner_url', 'Add Banner URL', $storeId);

try {
$query->getResource()->save($query);

Expand Down Expand Up @@ -188,4 +209,22 @@ private function prepareBannerContent($data)

return $content;
}

/**
* @param string $query
* @param string $attributeCode
* @param string $eventName
* @param int|null $storeId
*/
private function trackQueryMerchandisingData($query, $attributeCode, $eventName, $storeId = null)
{
if (($query->isObjectNew() && $query->getData($attributeCode))
|| $query->getOrigData($attributeCode) !== $query->getData($attributeCode)) {
$this->proxyHelper->trackEvent(
$this->configHelper->getApplicationID($storeId),
$eventName,
['source' => 'magento2.querymerch.edit']
);
}
}
}
4 changes: 2 additions & 2 deletions Controller/Adminhtml/Queue/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function _isAllowed()
return $this->_authorization->isAllowed('Algolia_AlgoliaSearch::manage');
}

/** @return \Algolia\AlgoliaSearch\Model */
/** @return \Algolia\AlgoliaSearch\Model\Job */
protected function initJob()
{
$jobId = (int) $this->getRequest()->getParam('id');
Expand All @@ -68,7 +68,7 @@ protected function initJob()
return null;
}

/** @var \Algolia\AlgoliaSearch\Model $model */
/** @var \Algolia\AlgoliaSearch\Model\Job $model */
$model = $this->jobFactory->create();
$this->jobResourceModel->load($model, $jobId);
if (!$model->getId()) {
Expand Down
Loading

0 comments on commit adf0740

Please sign in to comment.