Skip to content

Commit 64ff836

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-17269
2 parents ddb015e + 5177344 commit 64ff836

File tree

162 files changed

+8741
-2270
lines changed

Some content is hidden

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

162 files changed

+8741
-2270
lines changed

app/code/Magento/AuthorizenetGraphQl/Model/AuthorizenetDataProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99

1010
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
1111
use Magento\Framework\Stdlib\ArrayManager;
12-
use Magento\Framework\GraphQL\DataObjectConverter;
1312

1413
/**
1514
* DataProvider Model for Authorizenet
1615
*/
1716
class AuthorizenetDataProvider implements AdditionalDataProviderInterface
1817
{
19-
private const PATH_ADDITIONAL_DATA = 'input/payment_method/additional_data/authorizenet_acceptjs';
18+
private const PATH_ADDITIONAL_DATA = 'authorizenet_acceptjs';
2019

2120
/**
2221
* @var ArrayManager
@@ -36,12 +35,12 @@ public function __construct(
3635
/**
3736
* Return additional data
3837
*
39-
* @param array $args
38+
* @param array $data
4039
* @return array
4140
*/
42-
public function getData(array $args): array
41+
public function getData(array $data): array
4342
{
44-
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $args) ?? [];
43+
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data) ?? [];
4544
foreach ($additionalData as $key => $value) {
4645
$additionalData[$this->snakeCaseToCamelCase($key)] = $value;
4746
unset($additionalData[$key]);

app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
<group value="login"/>
2121
</annotations>
2222

23-
<amOnPage url="{{AdminLoginPage.url}}" stepKey="amOnAdminLoginPage"/>
24-
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{_ENV.MAGENTO_ADMIN_USERNAME}}" stepKey="fillUsername"/>
25-
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="fillPassword"/>
26-
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickOnSignIn"/>
27-
<closeAdminNotification stepKey="closeAdminNotification"/>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2824
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
25+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
2926
</test>
3027
</tests>

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Framework\App\ResourceConnection;
1111
use Magento\Catalog\Model\Product\Attribute\Source\Status;
12+
use Magento\Framework\EntityManager\MetadataPool;
1213
use Magento\Store\Model\Store;
1314

1415
/**
@@ -31,19 +32,28 @@ class Eraser
3132
*/
3233
protected $storeManager;
3334

35+
/**
36+
* @var MetadataPool
37+
*/
38+
private $metadataPool;
39+
3440
/**
3541
* @param \Magento\Framework\App\ResourceConnection $resource
3642
* @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
3743
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
44+
* @param MetadataPool|null $metadataPool
3845
*/
3946
public function __construct(
4047
\Magento\Framework\App\ResourceConnection $resource,
4148
\Magento\Catalog\Helper\Product\Flat\Indexer $productHelper,
42-
\Magento\Store\Model\StoreManagerInterface $storeManager
49+
\Magento\Store\Model\StoreManagerInterface $storeManager,
50+
MetadataPool $metadataPool = null
4351
) {
4452
$this->productIndexerHelper = $productHelper;
4553
$this->connection = $resource->getConnection();
4654
$this->storeManager = $storeManager;
55+
$this->metadataPool = $metadataPool ?:
56+
\Magento\Framework\App\ObjectManager::getInstance()->get(MetadataPool::class);
4757
}
4858

4959
/**
@@ -81,17 +91,24 @@ public function removeDisabledProducts(array &$ids, $storeId)
8191
/* @var $statusAttribute \Magento\Eav\Model\Entity\Attribute */
8292
$statusAttribute = $this->productIndexerHelper->getAttribute('status');
8393

94+
/** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
95+
$metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
96+
8497
$select = $this->getSelectForProducts($ids);
8598
$select->joinLeft(
8699
['status_global_attr' => $statusAttribute->getBackendTable()],
87100
' status_global_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
88-
. ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID,
101+
. ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID
102+
. ' AND status_global_attr.' . $statusAttribute->getEntityIdField() . '='
103+
. 'product_table.' . $metadata->getLinkField(),
89104
[]
90105
);
91106
$select->joinLeft(
92107
['status_attr' => $statusAttribute->getBackendTable()],
93108
' status_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
94-
. ' AND status_attr.store_id = ' . $storeId,
109+
. ' AND status_attr.store_id = ' . $storeId
110+
. ' AND status_attr.' . $statusAttribute->getEntityIdField() . '='
111+
. 'product_table.' . $metadata->getLinkField(),
95112
[]
96113
);
97114
$select->where('IFNULL(status_attr.value, status_global_attr.value) = ?', Status::STATUS_DISABLED);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private function getUsedImagesSelect(): Select
158158
'value as filepath'
159159
)->joinInner(
160160
['image_value' => $this->resourceConnection->getTableName(Gallery::GALLERY_VALUE_TABLE)],
161-
'images.value_id = image_value.value_id'
161+
'images.value_id = image_value.value_id',
162+
[]
162163
)->where(
163164
'images.disabled = 0 AND image_value.disabled = 0'
164165
);

app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ define([
3737
ajax: {
3838
url: options.url,
3939
type: 'POST',
40-
success: $.proxy(function (node) {
41-
return this._convertData(node[0]);
40+
success: $.proxy(function (nodes) {
41+
return this._convertDataNodes(nodes);
4242
}, this),
4343

4444
/**
@@ -77,6 +77,21 @@ define([
7777
}
7878
},
7979

80+
/**
81+
* @param {Array} nodes
82+
* @returns {Array}
83+
* @private
84+
*/
85+
_convertDataNodes: function (nodes) {
86+
var nodesData = [];
87+
88+
nodes.forEach(function (node) {
89+
nodesData.push(this._convertData(node));
90+
}, this);
91+
92+
return nodesData;
93+
},
94+
8095
/**
8196
* @param {Object} node
8297
* @return {*}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Cms\Model\Plugin;
9+
10+
use Magento\Catalog\Model\Product as CatalogProduct;
11+
use Magento\Cms\Model\Page;
12+
13+
/**
14+
* Cleaning no-route page cache for the product details page after enabling product that is not assigned to a category
15+
*/
16+
class Product
17+
{
18+
/**
19+
* @var Page
20+
*/
21+
private $page;
22+
23+
/**
24+
* @param Page $page
25+
*/
26+
public function __construct(Page $page)
27+
{
28+
$this->page = $page;
29+
}
30+
31+
/**
32+
* After get identities
33+
*
34+
* @param CatalogProduct $product
35+
* @param array $identities
36+
* @return array
37+
*/
38+
public function afterGetIdentities(CatalogProduct $product, array $identities)
39+
{
40+
if ($product->getOrigData('status') > $product->getData('status')) {
41+
if (empty($product->getCategoryIds())) {
42+
$noRoutePage = $this->page->load(Page::NOROUTE_PAGE_ID);
43+
$noRoutePageId = $noRoutePage->getId();
44+
$identities[] = Page::CACHE_TAG . '_' . $noRoutePageId;
45+
}
46+
}
47+
48+
return array_unique($identities);
49+
}
50+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Cms\Test\Unit\Model\Plugin;
9+
10+
use Magento\Catalog\Model\Product as CatalogProduct;
11+
use Magento\Cms\Model\Page;
12+
use Magento\Cms\Model\Plugin\Product;
13+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
14+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
15+
use PHPUnit\Framework\TestCase;
16+
17+
/**
18+
* Product plugin test
19+
*/
20+
class ProductTest extends TestCase
21+
{
22+
/**
23+
* @var Product
24+
*/
25+
private $plugin;
26+
27+
/**
28+
* @var MockObject|CatalogProduct
29+
*/
30+
private $product;
31+
32+
/**
33+
* @var MockObject|Page
34+
*/
35+
private $page;
36+
37+
/**
38+
* @inheritdoc
39+
*/
40+
protected function setUp()
41+
{
42+
$objectManager = new ObjectManager($this);
43+
44+
$this->product = $this->getMockBuilder(CatalogProduct::class)
45+
->disableOriginalConstructor()
46+
->setMethods(['getEntityId', 'getOrigData', 'getData', 'getCategoryIds'])
47+
->getMock();
48+
49+
$this->page = $this->getMockBuilder(Page::class)
50+
->disableOriginalConstructor()
51+
->setMethods(['getId', 'load'])
52+
->getMock();
53+
54+
$this->plugin = $objectManager->getObject(
55+
Product::class,
56+
[
57+
'page' => $this->page
58+
]
59+
);
60+
}
61+
62+
public function testAfterGetIdentities()
63+
{
64+
$baseIdentities = [
65+
'SomeCacheId',
66+
'AnotherCacheId',
67+
];
68+
$id = 12345;
69+
$pageId = 1;
70+
$expectedIdentities = [
71+
'SomeCacheId',
72+
'AnotherCacheId',
73+
Page::CACHE_TAG . '_' . $pageId,
74+
];
75+
76+
$this->product->method('getEntityId')
77+
->willReturn($id);
78+
$this->product->method('getOrigData')
79+
->with('status')
80+
->willReturn(2);
81+
$this->product->method('getData')
82+
->with('status')
83+
->willReturn(1);
84+
$this->page->method('getId')
85+
->willReturn(1);
86+
$this->page->method('load')
87+
->willReturnSelf();
88+
89+
$identities = $this->plugin->afterGetIdentities($this->product, $baseIdentities);
90+
91+
$this->assertEquals($expectedIdentities, $identities);
92+
}
93+
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,7 @@
233233
</argument>
234234
</arguments>
235235
</type>
236+
<type name="Magento\Catalog\Model\Product">
237+
<plugin name="cms" type="Magento\Cms\Model\Plugin\Product" sortOrder="100"/>
238+
</type>
236239
</config>
237-

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ define([
99

1010
return Sizes.extend({
1111
defaults: {
12-
excludedOptions: ['100', '200']
13-
},
14-
15-
/**
16-
* @override
17-
*/
18-
initialize: function () {
19-
this._super();
20-
21-
this.excludedOptions.forEach(function (excludedOption) {
22-
delete this.options[excludedOption];
23-
}, this);
24-
this.updateArray();
25-
26-
return this;
12+
options: {
13+
'20': {
14+
value: 20,
15+
label: 20
16+
},
17+
'30': {
18+
value: 30,
19+
label: 30
20+
},
21+
'50': {
22+
value: 50,
23+
label: 50
24+
}
25+
},
26+
value: 20
2727
}
2828
});
2929
});

app/code/Magento/CustomerGraphQl/Model/Context/AddUserInfoToContext.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,27 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
3939
if (null !== $currentUserId) {
4040
$currentUserId = (int)$currentUserId;
4141
}
42+
$contextParameters->setUserId($currentUserId);
4243

4344
$currentUserType = $this->userContext->getUserType();
4445
if (null !== $currentUserType) {
4546
$currentUserType = (int)$currentUserType;
4647
}
47-
48-
$contextParameters->setUserId($currentUserId);
4948
$contextParameters->setUserType($currentUserType);
49+
50+
$contextParameters->addExtensionAttribute('is_customer', $this->isCustomer($currentUserId, $currentUserType));
5051
return $contextParameters;
5152
}
53+
54+
/**
55+
* Checking if current user is logged
56+
*
57+
* @param int|null $customerId
58+
* @param int|null $customerType
59+
* @return bool
60+
*/
61+
private function isCustomer(?int $customerId, ?int $customerType): bool
62+
{
63+
return !empty($customerId) && !empty($customerType) && $customerType !== UserContextInterface::USER_TYPE_GUEST;
64+
}
5265
}

0 commit comments

Comments
 (0)