Skip to content

Commit 7843c95

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into libs-upgrade
2 parents d9729ba + cd151d5 commit 7843c95

File tree

73 files changed

+2025
-872
lines changed

Some content is hidden

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

73 files changed

+2025
-872
lines changed

.htaccess

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,15 @@
355355
Require all denied
356356
</IfVersion>
357357
</Files>
358+
<Files auth.json>
359+
<IfVersion < 2.4>
360+
order allow,deny
361+
deny from all
362+
</IfVersion>
363+
<IfVersion >= 2.4>
364+
Require all denied
365+
</IfVersion>
366+
</Files>
358367

359368
# For 404s and 403s that aren't handled by the application, show plain 404 response
360369
ErrorDocument 404 /pub/errors/404.php

.htaccess.sample

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,15 @@
332332
Require all denied
333333
</IfVersion>
334334
</Files>
335+
<Files auth.json>
336+
<IfVersion < 2.4>
337+
order allow,deny
338+
deny from all
339+
</IfVersion>
340+
<IfVersion >= 2.4>
341+
Require all denied
342+
</IfVersion>
343+
</Files>
335344

336345
# For 404s and 403s that aren't handled by the application, show plain 404 response
337346
ErrorDocument 404 /pub/errors/404.php

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.3-develop)](https://travis-ci.org/magento/magento2)
2+
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
23
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
34
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
45
<h2>Welcome</h2>

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

Lines changed: 10 additions & 1 deletion
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();
@@ -142,11 +142,20 @@ define([
142142
return true;
143143
},
144144

145+
/**
146+
* Returns state of place order button
147+
* @returns {Boolean}
148+
*/
149+
isButtonActive: function () {
150+
return this.isActive() && this.isPlaceOrderActionAllowed();
151+
},
152+
145153
/**
146154
* Trigger order placing
147155
*/
148156
placeOrderClick: function () {
149157
if (this.validateCardType()) {
158+
this.isPlaceOrderActionAllowed(false);
150159
$(this.getSelector('submit')).trigger('click');
151160
}
152161
},

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/Bundle/Model/OptionRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ public function save(
201201

202202
/** @var \Magento\Bundle\Model\Option $existingOption */
203203
$existingOption = $optionCollection->getFirstItem();
204-
if (!$optionId) {
205-
$option->setOptionId(null);
206-
}
207204
if (!$optionId || $existingOption->getParentId() != $parentId) {
205+
//If option ID is empty or existing option's parent ID is different
206+
//we'd need a new ID for the option.
207+
$option->setOptionId(null);
208208
$option->setDefaultTitle($option->getTitle());
209209
if (is_array($option->getProductLinks())) {
210210
$linksToAdd = $option->getProductLinks();

app/code/Magento/Bundle/Model/Product/SaveHandler.php

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Bundle\Model\Product;
77

8+
use Magento\Bundle\Api\Data\OptionInterface;
89
use Magento\Catalog\Api\Data\ProductInterface;
910
use Magento\Bundle\Api\ProductOptionRepositoryInterface as OptionRepository;
1011
use Magento\Bundle\Api\ProductLinkManagementInterface;
@@ -49,42 +50,58 @@ public function __construct(
4950
?: ObjectManager::getInstance()->get(MetadataPool::class);
5051
}
5152

53+
/**
54+
* @param ProductInterface $bundle
55+
* @param OptionInterface[] $currentOptions
56+
*
57+
* @return void
58+
*/
59+
private function removeOldOptions(
60+
ProductInterface $bundle,
61+
array $currentOptions
62+
) {
63+
$oldOptions = $this->optionRepository->getList($bundle->getSku());
64+
if ($oldOptions) {
65+
$remainingOptions = [];
66+
$metadata
67+
= $this->metadataPool->getMetadata(ProductInterface::class);
68+
$productId = $bundle->getData($metadata->getLinkField());
69+
70+
foreach ($currentOptions as $option) {
71+
$remainingOptions[] = $option->getOptionId();
72+
}
73+
foreach ($oldOptions as $option) {
74+
if (!in_array($option->getOptionId(), $remainingOptions)) {
75+
$option->setParentId($productId);
76+
$this->removeOptionLinks($bundle->getSku(), $option);
77+
$this->optionRepository->delete($option);
78+
}
79+
}
80+
}
81+
}
82+
5283
/**
5384
* @param object $entity
5485
* @param array $arguments
55-
* @return \Magento\Catalog\Api\Data\ProductInterface|object
86+
*
87+
* @return ProductInterface|object
88+
*
5689
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5790
*/
5891
public function execute($entity, $arguments = [])
5992
{
6093
/** @var \Magento\Bundle\Api\Data\OptionInterface[] $options */
6194
$options = $entity->getExtensionAttributes()->getBundleProductOptions() ?: [];
62-
95+
//Only processing bundle products.
6396
if ($entity->getTypeId() !== 'bundle' || empty($options)) {
6497
return $entity;
6598
}
66-
99+
/** @var ProductInterface $entity */
100+
//Removing old options
67101
if (!$entity->getCopyFromView()) {
68-
$updatedOptions = [];
69-
$oldOptions = $this->optionRepository->getList($entity->getSku());
70-
71-
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
72-
73-
$productId = $entity->getData($metadata->getLinkField());
74-
75-
foreach ($options as $option) {
76-
$updatedOptions[$option->getOptionId()][$productId] = (bool)$option->getOptionId();
77-
}
78-
79-
foreach ($oldOptions as $option) {
80-
if (!isset($updatedOptions[$option->getOptionId()][$productId])) {
81-
$option->setParentId($productId);
82-
$this->removeOptionLinks($entity->getSku(), $option);
83-
$this->optionRepository->delete($option);
84-
}
85-
}
102+
$this->removeOldOptions($entity, $options);
86103
}
87-
104+
//Saving active options.
88105
foreach ($options as $option) {
89106
$this->optionRepository->save($entity, $option);
90107
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function getGroupTreeJson()
233233
/* @var $node \Magento\Eav\Model\Entity\Attribute\Group */
234234
foreach ($groups as $node) {
235235
$item = [];
236-
$item['text'] = $node->getAttributeGroupName();
236+
$item['text'] = $this->escapeHtml($node->getAttributeGroupName());
237237
$item['id'] = $node->getAttributeGroupId();
238238
$item['cls'] = 'folder';
239239
$item['allowDrop'] = true;
@@ -280,7 +280,7 @@ public function getAttributeTreeJson()
280280

281281
foreach ($attributes as $child) {
282282
$attr = [
283-
'text' => $child->getAttributeCode(),
283+
'text' => $this->escapeHtml($child->getAttributeCode()),
284284
'id' => $child->getAttributeId(),
285285
'cls' => 'leaf',
286286
'allowDrop' => false,

app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,29 @@ public function __construct(
8787
$this->activeTableSwitcher = $activeTableSwitcher ?: $objectManager->get(ActiveTableSwitcher::class);
8888
}
8989

90+
/**
91+
*
92+
* Clear the table we'll be writing de-normalized data into
93+
* to prevent archived data getting in the way of actual data.
94+
*
95+
* @return void
96+
*/
97+
private function clearCurrentTable()
98+
{
99+
$this->connection->delete(
100+
$this->activeTableSwitcher
101+
->getAdditionalTableName($this->getMainTable())
102+
);
103+
}
104+
90105
/**
91106
* Refresh entities index
92107
*
93108
* @return $this
94109
*/
95110
public function execute()
96111
{
112+
$this->clearCurrentTable();
97113
$this->reindex();
98114
$this->activeTableSwitcher->switchTable($this->connection, [$this->getMainTable()]);
99115
return $this;
@@ -103,6 +119,9 @@ public function execute()
103119
* Return select for remove unnecessary data
104120
*
105121
* @return \Magento\Framework\DB\Select
122+
*
123+
* @deprecated Not used anymore.
124+
* @see clearCurrentTable()
106125
*/
107126
protected function getSelectUnnecessaryData()
108127
{
@@ -127,12 +146,14 @@ protected function getSelectUnnecessaryData()
127146
* Remove unnecessary data
128147
*
129148
* @return void
149+
*
150+
* @deprecated Not used anymore.
151+
* @see clearCurrentTable()
130152
*/
131153
protected function removeUnnecessaryData()
132154
{
133-
$this->connection->query(
134-
$this->connection->deleteFromSelect($this->getSelectUnnecessaryData(), $this->getMainTable())
135-
);
155+
//Called for backward compatibility.
156+
$this->getSelectUnnecessaryData();
136157
}
137158

138159
/**
@@ -233,6 +254,7 @@ private function reindexCategoriesBySelect(\Magento\Framework\DB\Select $basicSe
233254
)
234255
);
235256
$this->publishData();
257+
//Called for backward compatibility.
236258
$this->removeUnnecessaryData();
237259
}
238260
}

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@
315315
},
316316

317317
validateGroupName : function(name, exceptNodeId) {
318-
name = name.strip();
318+
name = name.strip().escapeHTML();
319319
var result = true;
320320
if (name === '') {
321321
result = false;

0 commit comments

Comments
 (0)