Skip to content

Commit b92eac4

Browse files
author
Roman Hanin
committed
Merge branch '2.4.3-develop' of https://github.com/magento/magento2ce into B2B-1832
2 parents bb8d148 + d8b6e12 commit b92eac4

File tree

34 files changed

+1250
-35
lines changed

34 files changed

+1250
-35
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@
5757
<argument name="path" xsi:type="string">web/default_layouts/default_cms_layout</argument>
5858
</arguments>
5959
</virtualType>
60+
<type name="Magento\Cms\Model\Wysiwyg\Config">
61+
<arguments>
62+
<argument name="variableConfig" xsi:type="object">Magento\Variable\Model\Variable\Config\Proxy</argument>
63+
</arguments>
64+
</type>
6065
</config>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Config\Model\Config;
10+
11+
use Magento\Framework\ObjectManager\NoninterceptableInterface;
12+
13+
/**
14+
* @inheritdoc
15+
*/
16+
class StructureLazy extends Structure implements NoninterceptableInterface
17+
{
18+
/**
19+
* @var Structure\Data
20+
*/
21+
private $structureData;
22+
23+
/**
24+
* @param \Magento\Config\Model\Config\Structure\Data $structureData
25+
* @param \Magento\Config\Model\Config\Structure\Element\Iterator\Tab $tabIterator
26+
* @param \Magento\Config\Model\Config\Structure\Element\FlyweightFactory $flyweightFactory
27+
* @param ScopeDefiner $scopeDefiner
28+
*/
29+
public function __construct(
30+
\Magento\Config\Model\Config\Structure\Data $structureData,
31+
\Magento\Config\Model\Config\Structure\Element\Iterator\Tab $tabIterator,
32+
\Magento\Config\Model\Config\Structure\Element\FlyweightFactory $flyweightFactory,
33+
ScopeDefiner $scopeDefiner
34+
) {
35+
$this->_tabIterator = $tabIterator;
36+
$this->_flyweightFactory = $flyweightFactory;
37+
$this->_scopeDefiner = $scopeDefiner;
38+
$this->structureData = $structureData;
39+
}
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
public function getElement($path)
45+
{
46+
$this->loadStructureData();
47+
return parent::getElement($path);
48+
}
49+
50+
/**
51+
* @inheritdoc
52+
*/
53+
public function getTabs()
54+
{
55+
$this->loadStructureData();
56+
return parent::getTabs();
57+
}
58+
59+
/**
60+
* @inheritdoc
61+
*/
62+
public function getSectionList()
63+
{
64+
$this->loadStructureData();
65+
return parent::getSectionList();
66+
}
67+
68+
/**
69+
* @inheritdoc
70+
*/
71+
public function getElementByConfigPath($path)
72+
{
73+
$this->loadStructureData();
74+
return parent::getElementByConfigPath($path);
75+
}
76+
77+
/**
78+
* @inheritdoc
79+
*/
80+
public function getFirstSection()
81+
{
82+
$this->loadStructureData();
83+
return parent::getTabs();
84+
}
85+
86+
/**
87+
* @inheritdoc
88+
*/
89+
public function getElementByPathParts(array $pathParts)
90+
{
91+
$this->loadStructureData();
92+
return parent:: getElementByPathParts($pathParts);
93+
}
94+
95+
/**
96+
* @inheritdoc
97+
*/
98+
public function getFieldPathsByAttribute($attributeName, $attributeValue)
99+
{
100+
$this->loadStructureData();
101+
return parent::getFieldPathsByAttribute($attributeName, $attributeValue);
102+
}
103+
104+
/**
105+
* @inheritdoc
106+
*/
107+
public function getFieldPaths()
108+
{
109+
$this->loadStructureData();
110+
return parent::getFieldPaths();
111+
}
112+
113+
/**
114+
* Load data
115+
*/
116+
private function loadStructureData()
117+
{
118+
if ($this->_data === null) {
119+
$this->_data = $this->structureData->get();
120+
}
121+
}
122+
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,9 @@
365365
<argument name="structure" xsi:type="object">adminhtmlConfigStructure</argument>
366366
</arguments>
367367
</type>
368+
<type name="Magento\Config\Model\Config">
369+
<arguments>
370+
<argument name="configStructure" xsi:type="object">\Magento\Config\Model\Config\Structure\Proxy</argument>
371+
</arguments>
372+
</type>
368373
</config>

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\CustomerGraphQl\Model\Context;
99

1010
use Magento\Authorization\Model\UserContextInterface;
11+
use Magento\Customer\Model\ResourceModel\CustomerRepository;
12+
use Magento\Customer\Model\Session;
1113
use Magento\GraphQl\Model\Query\ContextParametersInterface;
1214
use Magento\GraphQl\Model\Query\ContextParametersProcessorInterface;
1315

@@ -21,13 +23,29 @@ class AddUserInfoToContext implements ContextParametersProcessorInterface
2123
*/
2224
private $userContext;
2325

26+
/**
27+
* @var Session
28+
*/
29+
private $session;
30+
31+
/**
32+
* @var CustomerRepository
33+
*/
34+
private $customerRepository;
35+
2436
/**
2537
* @param UserContextInterface $userContext
38+
* @param Session $session
39+
* @param CustomerRepository $customerRepository
2640
*/
2741
public function __construct(
28-
UserContextInterface $userContext
42+
UserContextInterface $userContext,
43+
Session $session,
44+
CustomerRepository $customerRepository
2945
) {
3046
$this->userContext = $userContext;
47+
$this->session = $session;
48+
$this->customerRepository = $customerRepository;
3149
}
3250

3351
/**
@@ -47,7 +65,13 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
4765
}
4866
$contextParameters->setUserType($currentUserType);
4967

50-
$contextParameters->addExtensionAttribute('is_customer', $this->isCustomer($currentUserId, $currentUserType));
68+
$isCustomer = $this->isCustomer($currentUserId, $currentUserType);
69+
$contextParameters->addExtensionAttribute('is_customer', $isCustomer);
70+
if ($isCustomer) {
71+
$customer = $this->customerRepository->getById($currentUserId);
72+
$this->session->setCustomerData($customer);
73+
$this->session->setCustomerGroupId($customer->getGroupId());
74+
}
5175
return $contextParameters;
5276
}
5377

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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\CustomerGraphQl\Plugin;
9+
10+
use Magento\Authorization\Model\UserContextInterface;
11+
use Magento\Customer\Model\ResourceModel\CustomerRepository;
12+
use Magento\Customer\Model\Session as CustomerSession;
13+
use Magento\Framework\App\ResponseInterface;
14+
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\Exception\NoSuchEntityException;
16+
use Magento\GraphQl\Controller\GraphQl as GraphQlController;
17+
18+
/**
19+
* Clear the user data out of the session object before returning the GraphQL response
20+
*/
21+
class ClearCustomerSessionAfterRequest
22+
{
23+
/**
24+
* @var UserContextInterface
25+
*/
26+
private $userContext;
27+
28+
/**
29+
* @var CustomerSession
30+
*/
31+
private $customerSession;
32+
33+
/**
34+
* @var CustomerRepository
35+
*/
36+
private $customerRepository;
37+
38+
/**
39+
* @param UserContextInterface $userContext
40+
* @param CustomerSession $customerSession
41+
* @param CustomerRepository $customerRepository
42+
*/
43+
public function __construct(
44+
UserContextInterface $userContext,
45+
CustomerSession $customerSession,
46+
CustomerRepository $customerRepository
47+
) {
48+
$this->userContext = $userContext;
49+
$this->customerSession = $customerSession;
50+
$this->customerRepository = $customerRepository;
51+
}
52+
53+
/**
54+
* Clear the customer data from the session after business logic has completed
55+
*
56+
* @param GraphQlController $controller
57+
* @param ResponseInterface $response
58+
* @return ResponseInterface
59+
*
60+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
61+
*/
62+
public function afterDispatch(GraphQlController $controller, ResponseInterface $response): ResponseInterface
63+
{
64+
$this->customerSession->setCustomerId(null);
65+
$this->customerSession->setCustomerGroupId(null);
66+
return $response;
67+
}
68+
}

app/code/Magento/CustomerGraphQl/etc/graphql/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@
4040
</argument>
4141
</arguments>
4242
</type>
43+
<type name="Magento\GraphQl\Controller\GraphQl">
44+
<plugin name="ClearCustomerSessionAfterRequest" type="Magento\CustomerGraphQl\Plugin\ClearCustomerSessionAfterRequest" sortOrder="1" disabled="false" />
45+
</type>
4346
</config>

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ class Filter extends Template
201201
*/
202202
private $pubDirectoryRead;
203203

204-
205204
/**
206205
* Filter constructor.
207206
* @param StringUtils $string
@@ -851,7 +850,7 @@ private function isAvailableConfigVariable($variable)
851850
{
852851
return in_array(
853852
$variable,
854-
array_column($this->configVariables->getData(), 'value')
853+
$this->configVariables->getAvailableVars()
855854
);
856855
}
857856

@@ -912,7 +911,7 @@ public function cssDirective($construction)
912911
return '/*' . PHP_EOL . $exception->getMessage() . PHP_EOL . '*/';
913912
}
914913

915-
if (empty($css)){
914+
if (empty($css)) {
916915
return '/* ' . __('Contents of the specified CSS file could not be loaded or is empty') . ' */';
917916
}
918917

app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ class FilterTest extends TestCase
138138
*/
139139
private $variableResolver;
140140

141-
/**
142-
* @var MockObject|VariableResolverInterface
143-
*/
144-
private $variableResolverInterface;
145-
146141
/**
147142
* @var array
148143
*/
@@ -417,7 +412,7 @@ public function testApplyInlineCssThrowsExceptionWhenDesignParamsNotSet()
417412
public function testConfigDirectiveAvailable()
418413
{
419414
$path = "web/unsecure/base_url";
420-
$availableConfigs = [['value' => $path]];
415+
$availableConfigs = ['value' => $path];
421416
$construction = ["{{config path={$path}}}", 'config', " path={$path}"];
422417
$scopeConfigValue = 'value';
423418

@@ -429,7 +424,7 @@ public function testConfigDirectiveAvailable()
429424
$storeMock->expects($this->once())->method('getId')->willReturn(1);
430425

431426
$this->configVariables->expects($this->once())
432-
->method('getData')
427+
->method('getAvailableVars')
433428
->willReturn($availableConfigs);
434429
$this->scopeConfig->expects($this->once())
435430
->method('getValue')
@@ -452,7 +447,7 @@ public function testConfigDirectiveUnavailable()
452447
$storeMock->expects($this->once())->method('getId')->willReturn(1);
453448

454449
$this->configVariables->expects($this->once())
455-
->method('getData')
450+
->method('getAvailableVars')
456451
->willReturn($availableConfigs);
457452
$this->scopeConfig->expects($this->never())
458453
->method('getValue')

app/code/Magento/Paypal/Block/PayLater/LayoutProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public function process($jsLayout)
4949
{
5050
if (!$this->payLaterConfig->isEnabled(PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT)) {
5151
unset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']
52-
['children']['payment']['children']['payments-list']['children']['before-place-order']['children']
52+
['children']['payment']['children']['payments-list']['children']['paypal-method-extra-content']['children']
5353
['paylater-place-order']);
5454

5555
return $jsLayout;
5656
}
5757

5858
if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']
59-
['children']['payment']['children']['payments-list']['children']['before-place-order']['children']
59+
['children']['payment']['children']['payments-list']['children']['paypal-method-extra-content']['children']
6060
['paylater-place-order'])
6161
) {
6262
$payLaterPlaceOrder = &$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']
63-
['children']['payment']['children']['payments-list']['children']['before-place-order']['children']
63+
['children']['payment']['children']['payments-list']['children']['paypal-method-extra-content']['children']
6464
['paylater-place-order'];
6565

6666
$componentConfig = $payLaterPlaceOrder['config'] ?? [];

app/code/Magento/Paypal/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
<argument name="storage" xsi:type="object">Magento\Paypal\Model\PayflowSession\Storage</argument>
2727
</arguments>
2828
</virtualType>
29+
<type name="Magento\Paypal\Model\Config\StructurePlugin">
30+
<arguments>
31+
<argument xsi:type="object" name="backendHelper">Magento\Paypal\Helper\Backend\Proxy</argument>
32+
</arguments>
33+
</type>
2934
<type name="Magento\Config\Model\Config\Structure">
3035
<plugin name="paypal_system_configuration" type="Magento\Paypal\Model\Config\StructurePlugin"/>
3136
</type>

0 commit comments

Comments
 (0)