Skip to content

Commit 5f3068b

Browse files
authored
Merge branch '2.2-develop' into keep-maintenance-enabled
2 parents aa1f29c + 9c14af7 commit 5f3068b

File tree

61 files changed

+1161
-875
lines changed

Some content is hidden

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

61 files changed

+1161
-875
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ define([
6161
},
6262

6363
/**
64-
* @returns {Bool}
64+
* @returns {Boolean}
6565
*/
6666
isVaultEnabled: function () {
6767
return this.vaultEnabler.isVaultEnabled();
@@ -144,10 +144,19 @@ define([
144144
},
145145

146146
/**
147-
* Trigger order placing
147+
* Returns state of place order button
148+
* @returns {Boolean}
149+
*/
150+
isButtonActive: function () {
151+
return this.isActive() && this.isPlaceOrderActionAllowed();
152+
},
153+
154+
/**
155+
* Triggers order placing
148156
*/
149157
placeOrderClick: function () {
150158
if (this.validateCardType()) {
159+
this.isPlaceOrderActionAllowed(false);
151160
$(this.getSelector('submit')).trigger('click');
152161
}
153162
},

app/code/Magento/Braintree/view/frontend/web/template/payment/form.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@
141141
data-bind="
142142
click: placeOrderClick,
143143
attr: {title: $t('Place Order')},
144-
css: {disabled: !isPlaceOrderActionAllowed()},
145-
enable: isActive()
144+
enable: isButtonActive()
146145
"
147146
disabled>
148147
<span data-bind="i18n: 'Place Order'"></span>

app/code/Magento/Catalog/Cron/DeleteOutdatedPriceValues.php

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/**
1515
* Cron operation is responsible for deleting all product prices on WEBSITE level
16-
* in case 'Catalog Price Scope' configuratoin parameter is set to GLOBAL.
16+
* in case 'Catalog Price Scope' configuration parameter is set to GLOBAL.
1717
*/
1818
class DeleteOutdatedPriceValues
1919
{
@@ -48,27 +48,46 @@ public function __construct(
4848
}
4949

5050
/**
51-
* Delete all price values for non-admin stores if PRICE_SCOPE is global
51+
* Delete all price values for non-admin stores if PRICE_SCOPE is set to global.
5252
*
5353
* @return void
5454
*/
5555
public function execute()
5656
{
57-
$priceScope = $this->scopeConfig->getValue(Store::XML_PATH_PRICE_SCOPE);
58-
if ($priceScope == Store::PRICE_SCOPE_GLOBAL) {
59-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $priceAttribute */
60-
$priceAttribute = $this->attributeRepository
61-
->get(ProductAttributeInterface::ENTITY_TYPE_CODE, ProductAttributeInterface::CODE_PRICE);
62-
$connection = $this->resource->getConnection();
63-
$conditions = [
64-
$connection->quoteInto('attribute_id = ?', $priceAttribute->getId()),
65-
$connection->quoteInto('store_id != ?', Store::DEFAULT_STORE_ID),
66-
];
57+
if ($this->isPriceScopeSetToGlobal() === false) {
58+
return;
59+
}
60+
61+
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $priceAttribute */
62+
$priceAttribute = $this->attributeRepository
63+
->get(ProductAttributeInterface::ENTITY_TYPE_CODE, ProductAttributeInterface::CODE_PRICE);
64+
$connection = $this->resource->getConnection();
65+
$conditions = [
66+
$connection->quoteInto('attribute_id = ?', $priceAttribute->getId()),
67+
$connection->quoteInto('store_id != ?', Store::DEFAULT_STORE_ID),
68+
];
6769

68-
$connection->delete(
69-
$priceAttribute->getBackend()->getTable(),
70-
$conditions
71-
);
70+
$connection->delete(
71+
$priceAttribute->getBackend()->getTable(),
72+
$conditions
73+
);
74+
}
75+
76+
/**
77+
* Checks if price scope config option explicitly equal to global value.
78+
*
79+
* Such strict comparision is required to prevent price deleting when
80+
* price scope config option is null for some reason.
81+
*
82+
* @return bool
83+
*/
84+
private function isPriceScopeSetToGlobal()
85+
{
86+
$priceScope = $this->scopeConfig->getValue(Store::XML_PATH_PRICE_SCOPE);
87+
if ($priceScope === null) {
88+
return false;
7289
}
90+
91+
return (int)$priceScope === Store::PRICE_SCOPE_GLOBAL;
7392
}
7493
}

app/code/Magento/Catalog/Model/Category.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,11 @@ public function reindex()
10941094
if ($this->flatState->isFlatEnabled()) {
10951095
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
10961096
if (!$flatIndexer->isScheduled()) {
1097-
$flatIndexer->reindexRow($this->getId());
1097+
$idsList = [$this->getId()];
1098+
if ($this->dataHasChangedFor('url_key')) {
1099+
$idsList = array_merge($idsList, explode(',', $this->getAllChildren()));
1100+
}
1101+
$flatIndexer->reindexList($idsList);
10981102
}
10991103
}
11001104
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
318318
->will($this->returnValue(true));
319319

320320
$this->flatIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($flatScheduled));
321-
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexRow')->with('123');
321+
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexList')->with(['123']);
322322

323323
$this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
324324
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);

app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,29 @@ define([
259259

260260
obj.inputFieldEmailValue = email;
261261
saveData(obj);
262+
},
263+
264+
/**
265+
* Pulling the checked email value from persistence storage
266+
*
267+
* @return {*}
268+
*/
269+
getCheckedEmailValue: function () {
270+
var obj = getData();
271+
272+
return obj.checkedEmailValue ? obj.checkedEmailValue : '';
273+
},
274+
275+
/**
276+
* Setting the checked email value pulled from persistence storage
277+
*
278+
* @param {String} email
279+
*/
280+
setCheckedEmailValue: function (email) {
281+
var obj = getData();
282+
283+
obj.checkedEmailValue = email;
284+
saveData(obj);
262285
}
263286
};
264287
});

app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ define([
5454
return this;
5555
},
5656

57+
/** @inheritdoc */
58+
initConfig: function () {
59+
this._super();
60+
61+
this.isPasswordVisible = this.resolveInitialPasswordVisibility();
62+
63+
return this;
64+
},
65+
5766
/**
5867
* Callback on changing email property
5968
*/
@@ -81,20 +90,19 @@ define([
8190
* Check email existing.
8291
*/
8392
checkEmailAvailability: function () {
84-
var self = this;
85-
8693
this.validateRequest();
8794
this.isEmailCheckComplete = $.Deferred();
8895
this.isLoading(true);
8996
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());
9097

9198
$.when(this.isEmailCheckComplete).done(function () {
92-
self.isPasswordVisible(false);
93-
}).fail(function () {
94-
self.isPasswordVisible(true);
95-
}).always(function () {
96-
self.isLoading(false);
97-
});
99+
this.isPasswordVisible(false);
100+
}.bind(this)).fail(function () {
101+
this.isPasswordVisible(true);
102+
checkoutData.setCheckedEmailValue(this.email());
103+
}.bind(this)).always(function () {
104+
this.isLoading(false);
105+
}.bind(this));
98106
},
99107

100108
/**
@@ -153,6 +161,19 @@ define([
153161
fullScreenLoader.stopLoader();
154162
});
155163
}
164+
},
165+
166+
/**
167+
* Resolves an initial sate of a login form.
168+
*
169+
* @returns {Boolean} - initial visibility state.
170+
*/
171+
resolveInitialPasswordVisibility: function () {
172+
if (checkoutData.getInputFieldEmailValue() !== '') {
173+
return checkoutData.getInputFieldEmailValue() === checkoutData.getCheckedEmailValue();
174+
}
175+
176+
return false;
156177
}
157178
});
158179
});

app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Page/SaveTest.php

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -277,51 +277,4 @@ public function testSaveActionThrowsException()
277277

278278
$this->assertSame($this->resultRedirect, $this->saveController->execute());
279279
}
280-
281-
/**
282-
* Test for saving page after edit of it if page_id does not exists in the system
283-
*
284-
* @security-private
285-
*/
286-
public function testSaveNotExistingPage()
287-
{
288-
$this->pageId = 1111111111111111111111111;
289-
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(['page_id' => $this->pageId]);
290-
$this->requestMock->expects($this->atLeastOnce())
291-
->method('getParam')
292-
->willReturnMap(
293-
[
294-
['page_id', null, $this->pageId],
295-
['back', null, true],
296-
]
297-
);
298-
299-
$this->dataProcessorMock->expects($this->any())
300-
->method('filter')
301-
->willReturnArgument(0);
302-
$page = $this->getMockBuilder(\Magento\Cms\Model\Page::class)
303-
->disableOriginalConstructor()
304-
->getMock();
305-
$this->pageFactory->expects($this->atLeastOnce())
306-
->method('create')
307-
->willReturn($page);
308-
309-
$page->expects($this->any())
310-
->method('load')
311-
->willReturnSelf();
312-
$page->expects($this->any())
313-
->method('getId')
314-
->willReturn(null);
315-
316-
$this->messageManagerMock->expects($this->once())
317-
->method('addErrorMessage')
318-
->with(__('This page no longer exists.'));
319-
320-
$this->resultRedirect->expects($this->atLeastOnce())
321-
->method('setPath')
322-
->with('*/*/')
323-
->willReturnSelf();
324-
325-
$this->assertSame($this->resultRedirect, $this->saveController->execute());
326-
}
327280
}

app/code/Magento/Config/App/Config/Type/System.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function get($path = '')
141141
$pathParts = explode('/', $path);
142142
if (count($pathParts) === 1 && $pathParts[0] !== 'default') {
143143
if (!isset($this->data[$pathParts[0]])) {
144-
$data = $this->reader->read();
144+
$data = $this->readData();
145145
$this->data = array_replace_recursive($data, $this->data);
146146
}
147147
return $this->data[$pathParts[0]];
@@ -171,7 +171,7 @@ private function loadAllData()
171171
{
172172
$cachedData = $this->cache->load($this->configType);
173173
if ($cachedData === false) {
174-
$data = $this->reader->read();
174+
$data = $this->readData();
175175
} else {
176176
$data = $this->serializer->unserialize($cachedData);
177177
}
@@ -188,7 +188,7 @@ private function loadDefaultScopeData($scopeType)
188188
{
189189
$cachedData = $this->cache->load($this->configType . '_' . $scopeType);
190190
if ($cachedData === false) {
191-
$data = $this->reader->read();
191+
$data = $this->readData();
192192
$this->cacheData($data);
193193
} else {
194194
$data = [$scopeType => $this->serializer->unserialize($cachedData)];
@@ -216,7 +216,7 @@ private function loadScopeData($scopeType, $scopeId)
216216
if (is_array($this->availableDataScopes) && !isset($this->availableDataScopes[$scopeType][$scopeId])) {
217217
return [$scopeType => [$scopeId => []]];
218218
}
219-
$data = $this->reader->read();
219+
$data = $this->readData();
220220
$this->cacheData($data);
221221
} else {
222222
$data = [$scopeType => [$scopeId => $this->serializer->unserialize($cachedData)]];
@@ -282,6 +282,21 @@ private function getDataByPathParts($data, $pathParts)
282282
return $data;
283283
}
284284

285+
/**
286+
* The freshly read data.
287+
*
288+
* @return array
289+
*/
290+
private function readData(): array
291+
{
292+
$this->data = $this->reader->read();
293+
$this->data = $this->postProcessor->process(
294+
$this->data
295+
);
296+
297+
return $this->data;
298+
}
299+
285300
/**
286301
* Clean cache and global variables cache
287302
*

app/code/Magento/Config/App/Config/Type/System/Reader.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,13 @@ class Reader
2727
*/
2828
private $preProcessor;
2929

30-
/**
31-
* @var \Magento\Framework\App\Config\Spi\PostProcessorInterface
32-
*/
33-
private $postProcessor;
34-
3530
/**
3631
* Reader constructor.
3732
* @param \Magento\Framework\App\Config\ConfigSourceInterface $source
3833
* @param \Magento\Store\Model\Config\Processor\Fallback $fallback
3934
* @param \Magento\Framework\App\Config\Spi\PreProcessorInterface $preProcessor
4035
* @param \Magento\Framework\App\Config\Spi\PostProcessorInterface $postProcessor
36+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4137
*/
4238
public function __construct(
4339
\Magento\Framework\App\Config\ConfigSourceInterface $source,
@@ -48,7 +44,6 @@ public function __construct(
4844
$this->source = $source;
4945
$this->fallback = $fallback;
5046
$this->preProcessor = $preProcessor;
51-
$this->postProcessor = $postProcessor;
5247
}
5348

5449
/**
@@ -60,11 +55,9 @@ public function __construct(
6055
*/
6156
public function read()
6257
{
63-
return $this->postProcessor->process(
64-
$this->fallback->process(
65-
$this->preProcessor->process(
66-
$this->source->get()
67-
)
58+
return $this->fallback->process(
59+
$this->preProcessor->process(
60+
$this->source->get()
6861
)
6962
);
7063
}

app/code/Magento/Config/Test/Unit/App/Config/Type/System/ReaderTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ public function testGetCachedWithLoadDefaultScopeData()
8484
->method('process')
8585
->with($data)
8686
->willReturn($data);
87-
$this->postProcessor->expects($this->once())
88-
->method('process')
89-
->with($data)
90-
->willReturn($data);
9187
$this->assertEquals($data, $this->model->read());
9288
}
9389
}

0 commit comments

Comments
 (0)