Skip to content

Commit dd9ff5c

Browse files
committed
Merge branch 'github-2.3-develop' into MC-15341
2 parents 3fd8742 + 8a20a76 commit dd9ff5c

File tree

39 files changed

+587
-226
lines changed

39 files changed

+587
-226
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Magento 2 development team or community maintainers will review all issues a
1111
During the review we might require clarifications from the contributor.
1212
If there is no response from the contributor within two weeks, the pull request will be closed.
1313

14-
For more detialed information on contribution please read our [beginners guide](https://github.com/magento/magento2/wiki/Getting-Started).
14+
For more detailed information on contribution please read our [beginners guide](https://github.com/magento/magento2/wiki/Getting-Started).
1515

1616
## Contribution requirements
1717

app/code/Magento/CatalogRule/view/adminhtml/templates/promo/fieldset.phtml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
/**@var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $block */
108
?>
119
<?php $_element = $block->getElement() ?>
1210
<?php $_jsObjectName = $block->getFieldSetId() != null ? $block->getFieldSetId() : $_element->getHtmlId() ?>
1311
<div class="rule-tree">
14-
<fieldset id="<?= /* @escapeNotVerified */ $_jsObjectName ?>" <?= /* @escapeNotVerified */ $_element->serialize(['class']) ?> class="fieldset">
15-
<legend class="legend"><span><?= /* @escapeNotVerified */ $_element->getLegend() ?></span></legend>
12+
<fieldset id="<?= $block->escapeHtmlAttr($_jsObjectName) ?>" <?= /* @noEscape */ $_element->serialize(['class']) ?> class="fieldset">
13+
<legend class="legend"><span><?= $block->escapeHtml($_element->getLegend()) ?></span></legend>
1614
<br>
17-
<?php if ($_element->getComment()): ?>
15+
<?php if ($_element->getComment()) : ?>
1816
<div class="messages">
1917
<div class="message message-notice"><?= $block->escapeHtml($_element->getComment()) ?></div>
2018
</div>
@@ -30,9 +28,9 @@ require([
3028
"prototype"
3129
], function(VarienRulesForm){
3230

33-
window.<?= /* @escapeNotVerified */ $_jsObjectName ?> = new VarienRulesForm('<?= /* @escapeNotVerified */ $_jsObjectName ?>', '<?= /* @escapeNotVerified */ $block->getNewChildUrl() ?>');
34-
<?php if ($_element->getReadonly()): ?>
35-
<?= $_element->getHtmlId() ?>.setReadonly(true);
31+
window.<?= /* @noEscape */ $_jsObjectName ?> = new VarienRulesForm('<?= /* @noEscape */ $_jsObjectName ?>', '<?= /* @noEscape */ $block->getNewChildUrl() ?>');
32+
<?php if ($_element->getReadonly()) : ?>
33+
<?= /* @noEscape */ $_element->getHtmlId() ?>.setReadonly(true);
3634
<?php endif; ?>
3735

3836
});

app/code/Magento/CatalogRule/view/adminhtml/templates/promo/form.phtml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<div class="entry-edit rule-tree">
118
<?= $block->getFormHtml() ?>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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\Model\Context;
9+
10+
use Magento\Authorization\Model\UserContextInterface;
11+
use Magento\GraphQl\Model\Query\ContextParametersInterface;
12+
use Magento\GraphQl\Model\Query\ContextParametersProcessorInterface;
13+
14+
/**
15+
* @inheritdoc
16+
*/
17+
class AddUserInfoToContext implements ContextParametersProcessorInterface
18+
{
19+
/**
20+
* @var UserContextInterface
21+
*/
22+
private $userContext;
23+
24+
/**
25+
* @param UserContextInterface $userContext
26+
*/
27+
public function __construct(
28+
UserContextInterface $userContext
29+
) {
30+
$this->userContext = $userContext;
31+
}
32+
33+
/**
34+
* @inheritdoc
35+
*/
36+
public function execute(ContextParametersInterface $contextParameters): ContextParametersInterface
37+
{
38+
$currentUserId = $this->userContext->getUserId();
39+
if (null !== $currentUserId) {
40+
$currentUserId = (int)$currentUserId;
41+
}
42+
43+
$currentUserType = $this->userContext->getUserType();
44+
if (null !== $currentUserType) {
45+
$currentUserType = (int)$currentUserType;
46+
}
47+
48+
$contextParameters->setUserId($currentUserId);
49+
$contextParameters->setUserType($currentUserType);
50+
return $contextParameters;
51+
}
52+
}

app/code/Magento/CustomerGraphQl/Model/Customer/SaveCustomer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\Framework\Exception\AlreadyExistsException;
1212
use Magento\Framework\Exception\LocalizedException;
1313
use Magento\Framework\GraphQl\Exception\GraphQlAlreadyExistsException;
14-
use Magento\Framework\GraphQl\Exception\GraphQlAuthenticationException;
1514
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1615
use Magento\Customer\Api\Data\CustomerInterface;
1716

@@ -39,7 +38,6 @@ public function __construct(
3938
*
4039
* @param CustomerInterface $customer
4140
* @throws GraphQlAlreadyExistsException
42-
* @throws GraphQlAuthenticationException
4341
* @throws GraphQlInputException
4442
*/
4543
public function execute(CustomerInterface $customer): void

app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomer.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CustomerGraphQl\Model\Resolver;
99

10-
use Magento\Authorization\Model\UserContextInterface;
1110
use Magento\CustomerGraphQl\Model\Customer\CreateCustomerAccount;
1211
use Magento\CustomerGraphQl\Model\Customer\ExtractCustomerData;
1312
use Magento\Framework\GraphQl\Config\Element\Field;
@@ -58,9 +57,6 @@ public function resolve(
5857

5958
$customer = $this->createCustomerAccount->execute($args['input']);
6059

61-
$context->setUserId((int)$customer->getId());
62-
$context->setUserType(UserContextInterface::USER_TYPE_CUSTOMER);
63-
6460
$data = $this->extractCustomerData->execute($customer);
6561
return ['customer' => $data];
6662
}

app/code/Magento/CustomerGraphQl/Model/Resolver/IsSubscribed.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Magento\CustomerGraphQl\Model\Resolver;
99

10-
use Magento\CustomerGraphQl\Model\Customer\GetCustomer;
10+
use Magento\Framework\Exception\LocalizedException;
1111
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1212
use Magento\Framework\GraphQl\Config\Element\Field;
1313
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -18,25 +18,17 @@
1818
*/
1919
class IsSubscribed implements ResolverInterface
2020
{
21-
/**
22-
* @var GetCustomer
23-
*/
24-
private $getCustomer;
25-
2621
/**
2722
* @var SubscriberFactory
2823
*/
2924
private $subscriberFactory;
3025

3126
/**
32-
* @param GetCustomer $getCustomer
3327
* @param SubscriberFactory $subscriberFactory
3428
*/
3529
public function __construct(
36-
GetCustomer $getCustomer,
3730
SubscriberFactory $subscriberFactory
3831
) {
39-
$this->getCustomer = $getCustomer;
4032
$this->subscriberFactory = $subscriberFactory;
4133
}
4234

@@ -50,7 +42,11 @@ public function resolve(
5042
array $value = null,
5143
array $args = null
5244
) {
53-
$customer = $this->getCustomer->execute($context);
45+
if (!isset($value['model'])) {
46+
throw new LocalizedException(__('"model" value should be specified'));
47+
}
48+
/** @var Customer $customer */
49+
$customer = $value['model'];
5450

5551
$status = $this->subscriberFactory->create()->loadByCustomerId((int)$customer->getId())->isSubscribed();
5652
return (bool)$status;

app/code/Magento/CustomerGraphQl/composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
"type": "magento2-module",
55
"require": {
66
"php": "~7.1.3||~7.2.0",
7-
"magento/module-customer": "*",
87
"magento/module-authorization": "*",
8+
"magento/module-customer": "*",
99
"magento/module-eav": "*",
10+
"magento/module-graph-ql": "*",
1011
"magento/module-newsletter": "*",
1112
"magento/module-integration": "*",
1213
"magento/module-store": "*",
1314
"magento/framework": "*"
1415
},
15-
"suggest": {
16-
"magento/module-graph-ql": "*"
17-
},
1816
"license": [
1917
"OSL-3.0",
2018
"AFL-3.0"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
9+
<extension_attributes for="Magento\GraphQl\Model\Query\ContextInterface">
10+
<attribute code="customer" type="Magento\Customer\Api\Data\CustomerInterface"/>
11+
</extension_attributes>
12+
</config>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@
1313
</argument>
1414
</arguments>
1515
</type>
16-
</config>
16+
<type name="Magento\GraphQl\Model\Query\ContextFactory">
17+
<arguments>
18+
<argument name="contextParametersProcessors" xsi:type="array">
19+
<item name="add_user_info_to_context" xsi:type="object">Magento\CustomerGraphQl\Model\Context\AddUserInfoToContext</item>
20+
</argument>
21+
</arguments>
22+
</type>
23+
</config>

0 commit comments

Comments
 (0)