Skip to content

Commit 99e7237

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/2.3-develop' into 2.3-develop-pr
2 parents 9aeb142 + f3d7a0d commit 99e7237

File tree

48 files changed

+227
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+227
-172
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ cache:
5454
- $HOME/node_modules
5555
- $HOME/yarn.lock
5656
before_install:
57-
- 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
5857
- ./dev/travis/before_install.sh
5958
install: composer install --no-interaction
6059
before_script: ./dev/travis/before_script.sh

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ Tests:
489489
* Fixed an issue where found records in global search in Backend could not be selected via keyboard
490490
* Fixed an issue where Category menu items went out of screen when page side was reached
491491
* Fixed an issue where subcategories in menu were shown instantly when user moved mouse quickly
492-
* Fixed an issue where popup header was our of window range while creating group product
492+
* Fixed an issue where popup header was out of window range while creating group product
493493
* Fixed an issue where region field was absent in customer address form on backend for "United Kingdom" country
494494
* Fixed an ability to edit the Order from Admin panel
495495
* Fixed an issue where email could not be retrieved from \Magento\Quote\Api\Data\AddressInterface after adding an address on OnePageCheckout

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
<!-- ko foreach: { data: $record().elems(), as: 'elem'} -->
7171
<td if="elem.template"
72-
visible="elem.visible"
72+
visible="elem.visible() && elem.formElement !== 'hidden'"
7373
disable="elem.disabled"
7474
css="$parent.setClasses(elem)"
7575
template="elem.template"

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ protected function getPositionFieldConfig($sortOrder)
871871
'formElement' => Hidden::NAME,
872872
'dataScope' => static::FIELD_SORT_ORDER_NAME,
873873
'dataType' => Number::NAME,
874+
'visible' => false,
874875
'sortOrder' => $sortOrder,
875876
],
876877
],

app/code/Magento/Elasticsearch/Model/Config.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class Config implements ClientOptionsInterface
2525
*/
2626
const ENGINE_NAME = 'elasticsearch';
2727

28-
private const ENGINE_NAME_5 = 'elasticsearch5';
29-
3028
/**
3129
* Elasticsearch Entity type
3230
*/
@@ -64,23 +62,31 @@ class Config implements ClientOptionsInterface
6462
private $engineResolver;
6563

6664
/**
67-
* Constructor
65+
* Available Elasticsearch engines.
6866
*
67+
* @var array
68+
*/
69+
private $engineList;
70+
71+
/**
6972
* @param ScopeConfigInterface $scopeConfig
7073
* @param ClientResolver|null $clientResolver
7174
* @param EngineResolverInterface|null $engineResolver
7275
* @param string|null $prefix
76+
* @param array $engineList
7377
*/
7478
public function __construct(
7579
ScopeConfigInterface $scopeConfig,
7680
ClientResolver $clientResolver = null,
7781
EngineResolverInterface $engineResolver = null,
78-
$prefix = null
82+
$prefix = null,
83+
$engineList = []
7984
) {
8085
$this->scopeConfig = $scopeConfig;
8186
$this->clientResolver = $clientResolver ?: ObjectManager::getInstance()->get(ClientResolver::class);
8287
$this->engineResolver = $engineResolver ?: ObjectManager::getInstance()->get(EngineResolverInterface::class);
8388
$this->prefix = $prefix ?: $this->clientResolver->getCurrentEngine();
89+
$this->engineList = $engineList;
8490
}
8591

8692
/**
@@ -138,7 +144,7 @@ public function getSearchConfigData($field, $storeId = null)
138144
*/
139145
public function isElasticsearchEnabled()
140146
{
141-
return in_array($this->engineResolver->getCurrentSearchEngine(), [self::ENGINE_NAME, self::ENGINE_NAME_5]);
147+
return in_array($this->engineResolver->getCurrentSearchEngine(), $this->engineList);
142148
}
143149

144150
/**

app/code/Magento/Elasticsearch/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldIndex\ConverterInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldIndex\Converter" />
1414
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\ConverterInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProvider\FieldType\Converter" />
1515
<preference for="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\FieldProviderInterface" type="Magento\Elasticsearch\Model\Adapter\FieldMapper\Product\CompositeFieldProvider" />
16+
<type name="Magento\Elasticsearch\Model\Config">
17+
<arguments>
18+
<argument name="engineList" xsi:type="array">
19+
<item name="elasticsearch" xsi:type="string">elasticsearch</item>
20+
<item name="elasticsearch5" xsi:type="string">elasticsearch5</item>
21+
</argument>
22+
</arguments>
23+
</type>
1624

1725
<virtualType name="Magento\Elasticsearch\Model\Layer\Search\Context" type="Magento\Catalog\Model\Layer\Search\Context">
1826
<arguments>

app/code/Magento/Elasticsearch6/Model/Config.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

app/code/Magento/Elasticsearch6/Model/DataProvider/Suggestions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Store\Model\ScopeInterface;
1010
use Magento\Search\Model\QueryInterface;
1111
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
12-
use Magento\Elasticsearch6\Model\Config;
12+
use Magento\Elasticsearch\Model\Config;
1313
use Magento\Elasticsearch\SearchAdapter\ConnectionManager;
1414
use Magento\Search\Model\QueryResultFactory;
1515
use Magento\Framework\App\Config\ScopeConfigInterface;

app/code/Magento/Elasticsearch6/Test/Unit/Model/DataProvider/SuggestionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class SuggestionsTest extends \PHPUnit\Framework\TestCase
6767
*/
6868
protected function setUp()
6969
{
70-
$this->config = $this->getMockBuilder(\Magento\Elasticsearch6\Model\Config::class)
70+
$this->config = $this->getMockBuilder(\Magento\Elasticsearch\Model\Config::class)
7171
->disableOriginalConstructor()
7272
->setMethods(['isElasticsearchEnabled'])
7373
->getMock();

app/code/Magento/Elasticsearch6/etc/di.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<type name="Magento\Elasticsearch\Model\Config">
10+
<arguments>
11+
<argument name="engineList" xsi:type="array">
12+
<item name="elasticsearch6" xsi:type="string">elasticsearch6</item>
13+
</argument>
14+
</arguments>
15+
</type>
16+
917
<type name="Magento\Search\Model\Adminhtml\System\Config\Source\Engine">
1018
<arguments>
1119
<argument name="engines" xsi:type="array">
@@ -44,7 +52,7 @@
4452
<item name="elasticsearch6" xsi:type="string">\Magento\Elasticsearch6\Model\Client\ElasticsearchFactory</item>
4553
</argument>
4654
<argument name="clientOptions" xsi:type="array">
47-
<item name="elasticsearch6" xsi:type="string">\Magento\Elasticsearch6\Model\Config</item>
55+
<item name="elasticsearch6" xsi:type="string">\Magento\Elasticsearch\Model\Config</item>
4856
</argument>
4957
</arguments>
5058
</type>

app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Generate.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
namespace Magento\Sitemap\Controller\Adminhtml\Sitemap;
88

99
use Magento\Backend\App\Action;
10+
use Magento\Framework\App\Action\HttpGetActionInterface;
11+
use Magento\Sitemap\Controller\Adminhtml\Sitemap;
1012
use Magento\Store\Model\App\Emulation;
1113
use Magento\Framework\App\ObjectManager;
1214

13-
class Generate extends \Magento\Sitemap\Controller\Adminhtml\Sitemap
15+
/**
16+
* Generate sitemap file
17+
*/
18+
class Generate extends Sitemap implements HttpGetActionInterface
1419
{
1520
/** @var \Magento\Store\Model\App\Emulation $appEmulation */
1621
private $appEmulation;
@@ -44,23 +49,14 @@ public function execute()
4449
// if sitemap record exists
4550
if ($sitemap->getId()) {
4651
try {
47-
//We need to emulate to get the correct frontend URL for the product images
48-
$this->appEmulation->startEnvironmentEmulation(
49-
$sitemap->getStoreId(),
50-
\Magento\Framework\App\Area::AREA_FRONTEND,
51-
true
52-
);
5352
$sitemap->generateXml();
54-
5553
$this->messageManager->addSuccessMessage(
5654
__('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename())
5755
);
5856
} catch (\Magento\Framework\Exception\LocalizedException $e) {
5957
$this->messageManager->addErrorMessage($e->getMessage());
6058
} catch (\Exception $e) {
6159
$this->messageManager->addExceptionMessage($e, __('We can\'t generate the sitemap right now.'));
62-
} finally {
63-
$this->appEmulation->stopEnvironmentEmulation();
6460
}
6561
} else {
6662
$this->messageManager->addErrorMessage(__('We can\'t find a sitemap to generate.'));

app/code/Magento/Sitemap/Model/Observer.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Sitemap\Model;
77

8-
use Magento\Store\Model\App\Emulation;
98
use Magento\Sitemap\Model\EmailNotification as SitemapEmail;
109
use Magento\Framework\App\Config\ScopeConfigInterface;
1110
use Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory;
@@ -57,11 +56,6 @@ class Observer
5756
*/
5857
private $collectionFactory;
5958

60-
/**
61-
* @var Emulation
62-
*/
63-
private $appEmulation;
64-
6559
/**
6660
* @var $emailNotification
6761
*/
@@ -72,17 +66,14 @@ class Observer
7266
* @param ScopeConfigInterface $scopeConfig
7367
* @param CollectionFactory $collectionFactory
7468
* @param EmailNotification $emailNotification
75-
* @param Emulation $appEmulation
7669
*/
7770
public function __construct(
7871
ScopeConfigInterface $scopeConfig,
7972
CollectionFactory $collectionFactory,
80-
SitemapEmail $emailNotification,
81-
Emulation $appEmulation
73+
SitemapEmail $emailNotification
8274
) {
8375
$this->scopeConfig = $scopeConfig;
8476
$this->collectionFactory = $collectionFactory;
85-
$this->appEmulation = $appEmulation;
8677
$this->emailNotification = $emailNotification;
8778
}
8879

@@ -114,17 +105,9 @@ public function scheduledGenerateSitemaps()
114105
foreach ($collection as $sitemap) {
115106
/* @var $sitemap \Magento\Sitemap\Model\Sitemap */
116107
try {
117-
$this->appEmulation->startEnvironmentEmulation(
118-
$sitemap->getStoreId(),
119-
\Magento\Framework\App\Area::AREA_FRONTEND,
120-
true
121-
);
122-
123108
$sitemap->generateXml();
124109
} catch (\Exception $e) {
125110
$errors[] = $e->getMessage();
126-
} finally {
127-
$this->appEmulation->stopEnvironmentEmulation();
128111
}
129112
}
130113
if ($errors && $recipient) {

app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ protected function _prepareProduct(array $productRow, $storeId)
389389
*/
390390
protected function _loadProductImages($product, $storeId)
391391
{
392+
$this->_storeManager->setCurrentStore($storeId);
392393
/** @var $helper \Magento\Sitemap\Helper\Data */
393394
$helper = $this->_sitemapData;
394395
$imageIncludePolicy = $helper->getProductImageIncludePolicy($storeId);

app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail()
118118
->method('getStoreId')
119119
->willReturn($storeId);
120120

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

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

133-
$this->appEmulationMock->expects($this->at(0))
134-
->method('startEnvironmentEmulation')
135-
->with(
136-
$storeId,
137-
Area::AREA_FRONTEND,
138-
true
139-
);
140-
141-
$this->appEmulationMock->expects($this->at(1))
142-
->method('stopEnvironmentEmulation');
143-
144133
$this->observer->scheduledGenerateSitemaps();
145134
}
146135
}

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,11 @@ define([
12381238

12391239
if (!_.isUndefined(gallery)) {
12401240
gallery.updateData(imagesToUpdate);
1241+
} else {
1242+
context.find(this.options.mediaGallerySelector).on('gallery:loaded', function (loadedGallery) {
1243+
loadedGallery = context.find(this.options.mediaGallerySelector).data('gallery');
1244+
loadedGallery.updateData(imagesToUpdate);
1245+
}.bind(this));
12411246
}
12421247

12431248
if (isInitial) {
@@ -1248,6 +1253,7 @@ define([
12481253
dataMergeStrategy: this.options.gallerySwitchStrategy
12491254
});
12501255
}
1256+
12511257
} else if (justAnImage && justAnImage.img) {
12521258
context.find('.product-image-photo').attr('src', justAnImage.img);
12531259
}

app/code/Magento/Tax/etc/di.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
<arguments>
144144
<argument name="fieldMapping" xsi:type="array">
145145
<item name="id" xsi:type="string">tax_calculation_rule_id</item>
146+
<item name="code" xsi:type="string">main_table.code</item>
146147
<item name="tax_rate_ids" xsi:type="string">tax_calculation_rate_id</item>
147148
<item name="customer_tax_class_ids" xsi:type="string">cd.customer_tax_class_id</item>
148149
<item name="product_tax_class_ids" xsi:type="string">cd.product_tax_class_id</item>
@@ -154,6 +155,7 @@
154155
<arguments>
155156
<argument name="fieldMapping" xsi:type="array">
156157
<item name="id" xsi:type="string">tax_calculation_rule_id</item>
158+
<item name="code" xsi:type="string">main_table.code</item>
157159
<item name="tax_rate_ids" xsi:type="string">tax_calculation_rate_id</item>
158160
<item name="customer_tax_class_ids" xsi:type="string">cd.customer_tax_class_id</item>
159161
<item name="product_tax_class_ids" xsi:type="string">cd.product_tax_class_id</item>

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ define([
543543
data = this.createHeaderTemplate(cell.config);
544544
cell.config.labelVisible = false;
545545
_.extend(data, {
546+
defaultLabelVisible: data.visible(),
546547
label: cell.config.label,
547548
name: cell.name,
548549
required: !!cell.config.validation,

app/code/Magento/Ui/view/base/web/js/dynamic-rows/record.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ define([
245245
label = _.findWhere(this.parentComponent().labels(), {
246246
name: index
247247
});
248-
label.visible() !== state ? label.visible(state) : false;
248+
label.defaultLabelVisible && label.visible(state);
249249
} else {
250250
elems[curElem].visible(state);
251251
}

app/code/Magento/Ui/view/base/web/templates/dynamic-rows/templates/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<!-- ko foreach: { data: $record().elems(), as: 'elem'} -->
4242
<td if="elem.template"
4343
css="$parent.setClasses(elem)"
44-
visible="elem.visible"
44+
visible="elem.visible() && elem.formElement !== 'hidden'"
4545
disable="elem.disabled"
4646
template="elem.template"/>
4747
<!-- /ko -->

0 commit comments

Comments
 (0)