Skip to content

Commit

Permalink
Merge pull request #1184 from algolia/develop
Browse files Browse the repository at this point in the history
Merge develop into master for v3.3.0 release.
  • Loading branch information
rakesh-algolia authored May 2, 2022
2 parents 0757549 + d646567 commit 478c552
Show file tree
Hide file tree
Showing 45 changed files with 368 additions and 162 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:

"quality-tools":
docker:
- image: algolia/magento2-circleci:v3-2.3.5-p2
- image: algolia/magento2-circleci:2.4.4-php7.4-v1
working_directory: ~/build_directory/algoliasearch-magento-2
steps:
- checkout
Expand All @@ -92,8 +92,8 @@ jobs:
composer global require algolia/magento2-tools
# 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
mkdir ~/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
Expand Down
18 changes: 18 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .github/release.yml

changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: New Features 🎉
labels:
- Semver-Minor
- enhancement
- title: Bug Fixes
labels:
- "*"
16 changes: 9 additions & 7 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

/** @var PhpCsFixer\Config $config */
if (isset($_SERVER['argv']) && $_SERVER['argv'][3]) {
$config = require dirname($_SERVER['argv'][3], 3) . '/.php_cs.dist';
$config = require dirname($_SERVER['argv'][3], 3) . '/.php-cs-fixer.dist.php';
} else {
$config = require __DIR__ . '/../../../.php_cs.dist';
$config = require __DIR__ . '/../../../.php-cs-fixer.dist.php';
}

$originalRules = $config->getRules();
Expand All @@ -14,7 +14,7 @@
// Commented rules are released, but not in the version of PHP CS fixer Magento supports
$extensionRules = [
'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'blank_line_before_statement' => true,
'cast_spaces' => true,
'combine_consecutive_unsets' => true,
'mb_str_functions' => true,
Expand All @@ -23,7 +23,7 @@
'no_empty_statement' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'echo_tag_syntax' => true,
// 'no_superfluous_phpdoc_tags' => true,
'no_unneeded_control_parentheses' => true,
'no_unreachable_default_argument_value' => true,
Expand All @@ -37,20 +37,22 @@
'not_operator_with_space' => false,
'object_operator_without_whitespace' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_inline_tag' => true,
'general_phpdoc_tag_rename' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_tag_type' => true,
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'protected_to_private' => true,
'psr4' => true,
'psr_autoloading' => true,
'short_scalar_cast' => true, // ?
'single_blank_line_before_namespace' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
];

Expand Down
49 changes: 48 additions & 1 deletion Api/Data/JobInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,52 @@ interface JobInterface
const FIELD_RETRIES = 'retries';
const FIELD_ERROR_LOG = 'error_log';
const FIELD_DATA_SIZE = 'data_size';
/**#@-*/

/**
* @return string
*/
public function getClass(): string;

/**
* @param string $class
*
* @return $this
*/
public function setClass(string $class): self;

/**
* @return string
*/
public function getMethod(): string;

/**
* @param string $method
*
* @return $this
*/
public function setMethod(string $method): self;

/**
* @return string
*/
public function getBody(): string;

/**
* @param string $data
*
* @return $this
*/
public function setBody(string $data): self;

/**
* @return int
*/
public function getBodySize(): int;

/**
* @param int $size
*
* @return $this
*/
public function setBodySize(int $size): self;
}
2 changes: 1 addition & 1 deletion Block/Adminhtml/Job/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
$this->coreRegistry = $coreRegistry;
}

/** {@inheritdoc} */
/** @inheritdoc */
protected function _prepareLayout()
{
/** @var Button $button */
Expand Down
3 changes: 3 additions & 0 deletions Block/Adminhtml/Queue/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ public function getQueueRunnerStatus()
switch ($this->queueRunnerIndexer->getStatus()) {
case \Magento\Framework\Indexer\StateInterface::STATUS_VALID:
$status = 'Ready';

break;
case \Magento\Framework\Indexer\StateInterface::STATUS_INVALID:
$status = 'Reindex required';

break;
case \Magento\Framework\Indexer\StateInterface::STATUS_WORKING:
$status = 'Processing';

break;
}

Expand Down
2 changes: 1 addition & 1 deletion Block/Navigation/Renderer/CategoryRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function render(FilterInterface $filter)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function canRenderFilter()
{
Expand Down
6 changes: 3 additions & 3 deletions Block/Navigation/Renderer/DefaultRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getIsSearchable()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function render(FilterInterface $filter)
{
Expand All @@ -80,7 +80,7 @@ public function render(FilterInterface $filter)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getJsLayout()
{
Expand Down Expand Up @@ -109,7 +109,7 @@ public function getJsLayout()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function canRenderFilter()
{
Expand Down
2 changes: 1 addition & 1 deletion Block/Navigation/Renderer/PriceRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getFieldFormat()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function getConfig()
{
Expand Down
2 changes: 1 addition & 1 deletion Block/Navigation/Renderer/SliderRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function getDataRole()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function canRenderFilter()
{
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# CHANGE LOG

## 3.3.0

### UPDATES
- Updated to support the latest released Magento 2.4.4 with PHP 7.4 (#1173)
- Updated PHP Unit Integration Test for magento 2.4.4 (#1176)
- Release Notes Automation using github release.yml (#1174)

### FIXES
- Fixed the merchandised query on Query Merchandiser to display query-based products for merchandising (#1177)
- Fixed the issue with userToken not being sent to Algolia for the logged-in user for personalisation (#1178)
- Fixed the issue with requirejs not being defined on the swagger (#1172)

### TOOLING
- Update CS fixer with the Version 3 (#1173)

## 3.2.0

### UPDATES
Expand Down
2 changes: 2 additions & 0 deletions Controller/Adminhtml/Reindex/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function execute()

foreach ($skus as $sku) {
$sku = trim($sku);

try {

/** @var \Magento\Catalog\Model\Product $product */
Expand Down Expand Up @@ -196,6 +197,7 @@ private function checkAndReindex($product, $stores)
);

$this->checkAndReindex($parentProduct, $stores);

continue;
}
} else {
Expand Down
1 change: 1 addition & 0 deletions Helper/Adapter/FiltersHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public function getFacetFilters($storeId, $parameters = null)
if ($facet['attribute'] == 'categories') {
$level = '.level' . (count($facetValues) - 1);
$facetFilters[] = $facet['attribute'] . $level . ':' . implode(' /// ', $facetValues);

continue;
}

Expand Down
3 changes: 3 additions & 0 deletions Helper/AlgoliaHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ private function checkClient($methodName)

if (!isset($this->client)) {
$msg = 'Operation ' . $methodName . ' could not be performed because Algolia credentials were not provided.';

throw new AlgoliaException($msg);
}
}
Expand Down Expand Up @@ -470,6 +471,7 @@ private function prepareRecords(&$objects, $indexName)
- ID ' . $previousObject['objectID'] . ' - skipped - longest attribute: ' . $longestAttribute;

unset($objects[$key]);

continue;
} elseif ($previousObject !== $object) {
$modifiedIds[] = $indexName . ' - ID ' . $previousObject['objectID'] . ' - truncated';
Expand Down Expand Up @@ -745,6 +747,7 @@ protected function getAlgoliaFiltersArrayWithoutCurrentRefinement($filters, $nee
unset($filters[$i]);
$filters = array_values($filters);
$i--;

break;
}
}
Expand Down
1 change: 1 addition & 0 deletions Helper/AnalyticsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ private function fetch($path, array $params)
// analytics api requires index name for all calls
if (!isset($params['index'])) {
$msg = __('Algolia Analytics API requires an index name.');

throw new \Magento\Framework\Exception\LocalizedException($msg);
}

Expand Down
3 changes: 3 additions & 0 deletions Helper/Configuration/NoticeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,18 @@ protected function getPersonalizationNotice()
case 2: $warningContent = 'Personalization is based on actions a user has performed in the past. We help you collect some of the data automatically.</br>
After you\'ve collected a reasonable amount of data, Personlization can be applied.';
$icon = 'icon-warning';

break;
// Available but not activated
case 1: $warningContent = 'To start using this feature, please head over the <a href="https://www.algolia.com/dashboard" target="_blank`">Algolia Dashboard</a>,
and make sure you\'ve enabled Personalization in your account, as well as agreed to the terms and conditions of using Personalization.';
$icon = 'icon-warning';

break;
// Not Available
default: $warningContent = 'To get access to this Algolia feature, please <a target="_blank" href="https://www.algolia.com/contact/enterprise/">contact us</a>.';
$icon = 'icon-stars';

break;
}

Expand Down
7 changes: 7 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public function rebuildStorePageIndex($storeId, array $pageIds = null)
$this->algoliaHelper->addObjects($chunk, $toIndexName);
} catch (\Exception $e) {
$this->logger->log($e->getMessage());

continue;
}
}
Expand All @@ -219,6 +220,7 @@ public function rebuildStorePageIndex($storeId, array $pageIds = null)
$this->algoliaHelper->deleteObjects($chunk, $indexName);
} catch (\Exception $e) {
$this->logger->log($e->getMessage());

continue;
}
}
Expand Down Expand Up @@ -266,6 +268,7 @@ public function rebuildStoreCategoryIndex($storeId, $categoryIds = null)
}
} catch (\Exception $e) {
$this->stopEmulation();

throw $e;
}

Expand Down Expand Up @@ -327,6 +330,7 @@ public function rebuildStoreProductIndex($storeId, $productIds)
$this->startEmulation($storeId);

$this->logger->start('Indexing');

try {
$this->logger->start('ok');

Expand Down Expand Up @@ -359,6 +363,7 @@ public function rebuildStoreProductIndex($storeId, $productIds)
}
} catch (\Exception $e) {
$this->stopEmulation();

throw $e;
}
$this->logger->stop('Indexing');
Expand Down Expand Up @@ -518,6 +523,7 @@ private function getProductsRecords($storeId, $collection, $potentiallyDeletedPr
$this->productHelper->canProductBeReindexed($product, $storeId);
} catch (ProductReindexingException $e) {
$productsToRemove[$productId] = $productId;

continue;
}

Expand Down Expand Up @@ -589,6 +595,7 @@ private function getCategoryRecords($storeId, $collection, $potentiallyDeletedCa
$this->categoryHelper->canCategoryBeReindexed($category, $storeId);
} catch (CategoryReindexingException $e) {
$categoriesToRemove[$categoryId] = $categoryId;

continue;
}

Expand Down
1 change: 1 addition & 0 deletions Helper/Entity/CategoryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public function getObject(Category $category)
}

$imageUrl = null;

try {
$imageUrl = $category->getImageUrl();
} catch (\Exception $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ protected function getTierPrice(Product $product, $currencyCode, $withTax)
foreach ($productTierPrices as $productTierPrice) {
if (!isset($tierPrices[$productTierPrice->getCustomerGroupId()])) {
$tierPrices[$productTierPrice->getCustomerGroupId()] = $productTierPrice->getValue();

continue;
}

Expand Down
Loading

0 comments on commit 478c552

Please sign in to comment.