Skip to content

Commit

Permalink
Merge branch 2.3-develop into ENGCOM-4475-magento-magento2-21649
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Mar 15, 2019
2 parents 98c0300 + f3d7a0d commit 4d90bc3
Show file tree
Hide file tree
Showing 48 changed files with 227 additions and 172 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ cache:
- $HOME/node_modules
- $HOME/yarn.lock
before_install:
- curl -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.0/elasticsearch-2.3.0.deb && sudo dpkg -i --force-confnew elasticsearch-2.3.0.deb && sudo service elasticsearch restart
- ./dev/travis/before_install.sh
install: composer install --no-interaction
before_script: ./dev/travis/before_script.sh
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ Tests:
* Fixed an issue where found records in global search in Backend could not be selected via keyboard
* Fixed an issue where Category menu items went out of screen when page side was reached
* Fixed an issue where subcategories in menu were shown instantly when user moved mouse quickly
* Fixed an issue where popup header was our of window range while creating group product
* Fixed an issue where popup header was out of window range while creating group product
* Fixed an issue where region field was absent in customer address form on backend for "United Kingdom" country
* Fixed an ability to edit the Order from Admin panel
* Fixed an issue where email could not be retrieved from \Magento\Quote\Api\Data\AddressInterface after adding an address on OnePageCheckout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

<!-- ko foreach: { data: $record().elems(), as: 'elem'} -->
<td if="elem.template"
visible="elem.visible"
visible="elem.visible() && elem.formElement !== 'hidden'"
disable="elem.disabled"
css="$parent.setClasses(elem)"
template="elem.template"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ protected function getPositionFieldConfig($sortOrder)
'formElement' => Hidden::NAME,
'dataScope' => static::FIELD_SORT_ORDER_NAME,
'dataType' => Number::NAME,
'visible' => false,
'sortOrder' => $sortOrder,
],
],
Expand Down
16 changes: 11 additions & 5 deletions app/code/Magento/Elasticsearch/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class Config implements ClientOptionsInterface
*/
const ENGINE_NAME = 'elasticsearch';

private const ENGINE_NAME_5 = 'elasticsearch5';

/**
* Elasticsearch Entity type
*/
Expand Down Expand Up @@ -64,23 +62,31 @@ class Config implements ClientOptionsInterface
private $engineResolver;

/**
* Constructor
* Available Elasticsearch engines.
*
* @var array
*/
private $engineList;

/**
* @param ScopeConfigInterface $scopeConfig
* @param ClientResolver|null $clientResolver
* @param EngineResolverInterface|null $engineResolver
* @param string|null $prefix
* @param array $engineList
*/
public function __construct(
ScopeConfigInterface $scopeConfig,
ClientResolver $clientResolver = null,
EngineResolverInterface $engineResolver = null,
$prefix = null
$prefix = null,
$engineList = []
) {
$this->scopeConfig = $scopeConfig;
$this->clientResolver = $clientResolver ?: ObjectManager::getInstance()->get(ClientResolver::class);
$this->engineResolver = $engineResolver ?: ObjectManager::getInstance()->get(EngineResolverInterface::class);
$this->prefix = $prefix ?: $this->clientResolver->getCurrentEngine();
$this->engineList = $engineList;
}

/**
Expand Down Expand Up @@ -138,7 +144,7 @@ public function getSearchConfigData($field, $storeId = null)
*/
public function isElasticsearchEnabled()
{
return in_array($this->engineResolver->getCurrentSearchEngine(), [self::ENGINE_NAME, self::ENGINE_NAME_5]);
return in_array($this->engineResolver->getCurrentSearchEngine(), $this->engineList);
}

/**
Expand Down
8 changes: 8 additions & 0 deletions app/code/Magento/Elasticsearch/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldIndex\ConverterInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldIndex\Converter" />
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\ConverterInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\Converter" />
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProviderInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\CompositeFieldProvider" />
<type name="Magento\Elasticsearch\Model\Config">
<arguments>
<argument name="engineList" xsi:type="array">
<item name="elasticsearch" xsi:type="string">elasticsearch</item>
<item name="elasticsearch5" xsi:type="string">elasticsearch5</item>
</argument>
</arguments>
</type>

<virtualType name="Magento\Elasticsearch\Model\Layer\Search\Context" type="Magento\Catalog\Model\Layer\Search\Context">
<arguments>
Expand Down
56 changes: 0 additions & 56 deletions app/code/Magento/Elasticsearch6/Model/Config.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Magento\Store\Model\ScopeInterface;
use Magento\Search\Model\QueryInterface;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
use Magento\Elasticsearch6\Model\Config;
use Magento\Elasticsearch\Model\Config;
use Magento\Elasticsearch\SearchAdapter\ConnectionManager;
use Magento\Search\Model\QueryResultFactory;
use Magento\Framework\App\Config\ScopeConfigInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SuggestionsTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp()
{
$this->config = $this->getMockBuilder(\Magento\Elasticsearch6\Model\Config::class)
$this->config = $this->getMockBuilder(\Magento\Elasticsearch\Model\Config::class)
->disableOriginalConstructor()
->setMethods(['isElasticsearchEnabled'])
->getMock();
Expand Down
10 changes: 9 additions & 1 deletion app/code/Magento/Elasticsearch6/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Elasticsearch\Model\Config">
<arguments>
<argument name="engineList" xsi:type="array">
<item name="elasticsearch6" xsi:type="string">elasticsearch6</item>
</argument>
</arguments>
</type>

<type name="Magento\Search\Model\Adminhtml\System\Config\Source\Engine">
<arguments>
<argument name="engines" xsi:type="array">
Expand Down Expand Up @@ -44,7 +52,7 @@
<item name="elasticsearch6" xsi:type="string">\Magento\Elasticsearch6\Model\Client\ElasticsearchFactory</item>
</argument>
<argument name="clientOptions" xsi:type="array">
<item name="elasticsearch6" xsi:type="string">\Magento\Elasticsearch6\Model\Config</item>
<item name="elasticsearch6" xsi:type="string">\Magento\Elasticsearch\Model\Config</item>
</argument>
</arguments>
</type>
Expand Down
16 changes: 6 additions & 10 deletions app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
namespace Magento\Sitemap\Controller\Adminhtml\Sitemap;

use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Sitemap\Controller\Adminhtml\Sitemap;
use Magento\Store\Model\App\Emulation;
use Magento\Framework\App\ObjectManager;

class Generate extends \Magento\Sitemap\Controller\Adminhtml\Sitemap
/**
* Generate sitemap file
*/
class Generate extends Sitemap implements HttpGetActionInterface
{
/** @var \Magento\Store\Model\App\Emulation $appEmulation */
private $appEmulation;
Expand Down Expand Up @@ -44,23 +49,14 @@ public function execute()
// if sitemap record exists
if ($sitemap->getId()) {
try {
//We need to emulate to get the correct frontend URL for the product images
$this->appEmulation->startEnvironmentEmulation(
$sitemap->getStoreId(),
\Magento\Framework\App\Area::AREA_FRONTEND,
true
);
$sitemap->generateXml();

$this->messageManager->addSuccessMessage(
__('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename())
);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addExceptionMessage($e, __('We can\'t generate the sitemap right now.'));
} finally {
$this->appEmulation->stopEnvironmentEmulation();
}
} else {
$this->messageManager->addErrorMessage(__('We can\'t find a sitemap to generate.'));
Expand Down
19 changes: 1 addition & 18 deletions app/code/Magento/Sitemap/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\Sitemap\Model;

use Magento\Store\Model\App\Emulation;
use Magento\Sitemap\Model\EmailNotification as SitemapEmail;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory;
Expand Down Expand Up @@ -57,11 +56,6 @@ class Observer
*/
private $collectionFactory;

/**
* @var Emulation
*/
private $appEmulation;

/**
* @var $emailNotification
*/
Expand All @@ -72,17 +66,14 @@ class Observer
* @param ScopeConfigInterface $scopeConfig
* @param CollectionFactory $collectionFactory
* @param EmailNotification $emailNotification
* @param Emulation $appEmulation
*/
public function __construct(
ScopeConfigInterface $scopeConfig,
CollectionFactory $collectionFactory,
SitemapEmail $emailNotification,
Emulation $appEmulation
SitemapEmail $emailNotification
) {
$this->scopeConfig = $scopeConfig;
$this->collectionFactory = $collectionFactory;
$this->appEmulation = $appEmulation;
$this->emailNotification = $emailNotification;
}

Expand Down Expand Up @@ -114,17 +105,9 @@ public function scheduledGenerateSitemaps()
foreach ($collection as $sitemap) {
/* @var $sitemap \Magento\Sitemap\Model\Sitemap */
try {
$this->appEmulation->startEnvironmentEmulation(
$sitemap->getStoreId(),
\Magento\Framework\App\Area::AREA_FRONTEND,
true
);

$sitemap->generateXml();
} catch (\Exception $e) {
$errors[] = $e->getMessage();
} finally {
$this->appEmulation->stopEnvironmentEmulation();
}
}
if ($errors && $recipient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ protected function _prepareProduct(array $productRow, $storeId)
*/
protected function _loadProductImages($product, $storeId)
{
$this->_storeManager->setCurrentStore($storeId);
/** @var $helper \Magento\Sitemap\Helper\Data */
$helper = $this->_sitemapData;
$imageIncludePolicy = $helper->getProductImageIncludePolicy($storeId);
Expand Down
13 changes: 1 addition & 12 deletions app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail()
->method('getStoreId')
->willReturn($storeId);

$this->sitemapMock->expects($this->at(1))
$this->sitemapMock->expects($this->once())
->method('generateXml')
->willThrowException(new \Exception($exception));

Expand All @@ -130,17 +130,6 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail()
)
->willReturn('error-recipient@example.com');

$this->appEmulationMock->expects($this->at(0))
->method('startEnvironmentEmulation')
->with(
$storeId,
Area::AREA_FRONTEND,
true
);

$this->appEmulationMock->expects($this->at(1))
->method('stopEnvironmentEmulation');

$this->observer->scheduledGenerateSitemaps();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,11 @@ define([

if (!_.isUndefined(gallery)) {
gallery.updateData(imagesToUpdate);
} else {
context.find(this.options.mediaGallerySelector).on('gallery:loaded', function (loadedGallery) {
loadedGallery = context.find(this.options.mediaGallerySelector).data('gallery');
loadedGallery.updateData(imagesToUpdate);
}.bind(this));
}

if (isInitial) {
Expand All @@ -1248,6 +1253,7 @@ define([
dataMergeStrategy: this.options.gallerySwitchStrategy
});
}

} else if (justAnImage && justAnImage.img) {
context.find('.product-image-photo').attr('src', justAnImage.img);
}
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Tax/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<arguments>
<argument name="fieldMapping" xsi:type="array">
<item name="id" xsi:type="string">tax_calculation_rule_id</item>
<item name="code" xsi:type="string">main_table.code</item>
<item name="tax_rate_ids" xsi:type="string">tax_calculation_rate_id</item>
<item name="customer_tax_class_ids" xsi:type="string">cd.customer_tax_class_id</item>
<item name="product_tax_class_ids" xsi:type="string">cd.product_tax_class_id</item>
Expand All @@ -154,6 +155,7 @@
<arguments>
<argument name="fieldMapping" xsi:type="array">
<item name="id" xsi:type="string">tax_calculation_rule_id</item>
<item name="code" xsi:type="string">main_table.code</item>
<item name="tax_rate_ids" xsi:type="string">tax_calculation_rate_id</item>
<item name="customer_tax_class_ids" xsi:type="string">cd.customer_tax_class_id</item>
<item name="product_tax_class_ids" xsi:type="string">cd.product_tax_class_id</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ define([
data = this.createHeaderTemplate(cell.config);
cell.config.labelVisible = false;
_.extend(data, {
defaultLabelVisible: data.visible(),
label: cell.config.label,
name: cell.name,
required: !!cell.config.validation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ define([
label = _.findWhere(this.parentComponent().labels(), {
name: index
});
label.visible() !== state ? label.visible(state) : false;
label.defaultLabelVisible && label.visible(state);
} else {
elems[curElem].visible(state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<!-- ko foreach: { data: $record().elems(), as: 'elem'} -->
<td if="elem.template"
css="$parent.setClasses(elem)"
visible="elem.visible"
visible="elem.visible() && elem.formElement !== 'hidden'"
disable="elem.disabled"
template="elem.template"/>
<!-- /ko -->
Expand Down
Loading

0 comments on commit 4d90bc3

Please sign in to comment.