Skip to content

Commit dd965b9

Browse files
authored
Merge pull request #3 from magento/2.3-develop
merge latest changes
2 parents 3ba9281 + 877bffd commit dd965b9

File tree

22 files changed

+297
-113
lines changed

22 files changed

+297
-113
lines changed

app/code/Magento/Backup/Controller/Adminhtml/Index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,24 @@
55
*/
66
namespace Magento\Backup\Controller\Adminhtml;
77

8+
use Magento\Backend\App\Action;
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
10+
811
/**
912
* Backup admin controller
1013
*
1114
* @author Magento Core Team <core@magentocommerce.com>
1215
* @api
1316
* @since 100.0.2
1417
*/
15-
abstract class Index extends \Magento\Backend\App\Action
18+
abstract class Index extends Action implements HttpGetActionInterface
1619
{
1720
/**
1821
* Authorization level of a basic admin session
1922
*
2023
* @see _isAllowed()
2124
*/
22-
const ADMIN_RESOURCE = 'Magento_Backend::backup';
25+
const ADMIN_RESOURCE = 'Magento_Backup::backup';
2326

2427
/**
2528
* Core registry

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductHtmlAttribute.php renamed to app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductComplexTextAttribute.php

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

88
namespace Magento\CatalogGraphQl\Model\Resolver\Product;
99

10-
use Magento\Catalog\Model\Product;
1110
use Magento\Framework\GraphQl\Config\Element\Field;
12-
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1311
use Magento\Framework\GraphQl\Query\ResolverInterface;
1412
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
13+
use Magento\Catalog\Model\Product;
14+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1515
use Magento\Catalog\Helper\Output as OutputHelper;
1616

1717
/**
1818
* Resolve rendered content for attributes where HTML content is allowed
1919
*/
20-
class ProductHtmlAttribute implements ResolverInterface
20+
class ProductComplexTextAttribute implements ResolverInterface
2121
{
2222
/**
2323
* @var OutputHelper
@@ -42,7 +42,7 @@ public function resolve(
4242
ResolveInfo $info,
4343
array $value = null,
4444
array $args = null
45-
) {
45+
): array {
4646
if (!isset($value['model'])) {
4747
throw new GraphQlInputException(__('"model" value should be specified'));
4848
}
@@ -51,6 +51,7 @@ public function resolve(
5151
$product = $value['model'];
5252
$fieldName = $field->getName();
5353
$renderedValue = $this->outputHelper->productAttribute($product, $product->getData($fieldName), $fieldName);
54-
return $renderedValue;
54+
55+
return ['html' => $renderedValue ?? ''];
5556
}
5657
}

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
248248
id: Int @doc(description: "The ID number assigned to the product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\EntityIdToId")
249249
name: String @doc(description: "The product name. Customers use this name to identify the product.")
250250
sku: String @doc(description: "A number or code assigned to a product to identify the product, options, price, and manufacturer")
251-
description: String @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductHtmlAttribute")
252-
short_description: String @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductHtmlAttribute")
251+
description: ComplexTextValue @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
252+
short_description: ComplexTextValue @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
253253
special_price: Float @doc(description: "The discounted price of the product")
254254
special_from_date: String @doc(description: "The beginning date that a product has a special price")
255255
special_to_date: String @doc(description: "The end date that a product has a special price")

app/code/Magento/GraphQl/etc/schema.graphqls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ enum SortEnum @doc(description: "This enumeration indicates whether to return re
3636
ASC
3737
DESC
3838
}
39+
40+
type ComplexTextValue {
41+
html: String! @doc(description: "HTML format")
42+
}

app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function getAssociatedProducts($product)
236236
*/
237237
public function flushAssociatedProductsCache($product)
238238
{
239-
return $product->unsData($this->_keyAssociatedProducts);
239+
return $product->unsetData($this->_keyAssociatedProducts);
240240
}
241241

242242
/**

app/code/Magento/GroupedProduct/Test/Unit/Model/Product/Type/GroupedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,9 @@ public function testPrepareForCartAdvancedZeroQty()
611611

612612
public function testFlushAssociatedProductsCache()
613613
{
614-
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsData']);
614+
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsetData']);
615615
$productMock->expects($this->once())
616-
->method('unsData')
616+
->method('unsetData')
617617
->with('_cache_instance_associated_products')
618618
->willReturnSelf();
619619
$this->assertEquals($productMock, $this->_model->flushAssociatedProductsCache($productMock));

app/code/Magento/Quote/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/>
2828
<waitForPageLoad stepKey="waitForDisable"/>
2929
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
30+
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
3031
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
3132
</actionGroup>
3233
</actionGroups>

app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function beforeSave()
113113
/**
114114
* Retrieve visitor id
115115
*
116-
* if don't exists return current visitor id
116+
* If don't exists return current visitor id
117117
*
118118
* @return int
119119
*/
@@ -128,7 +128,7 @@ public function getVisitorId()
128128
/**
129129
* Retrieve customer id
130130
*
131-
* if customer don't logged in return null
131+
* If customer don't logged in return null
132132
*
133133
* @return int
134134
*/
@@ -143,7 +143,7 @@ public function getCustomerId()
143143
/**
144144
* Retrieve store id
145145
*
146-
* default return current store id
146+
* Default return current store id
147147
*
148148
* @return int
149149
*/
@@ -246,13 +246,14 @@ public function clean()
246246

247247
/**
248248
* Add product ids to current visitor/customer log
249+
*
249250
* @param string[] $productIds
250251
* @return $this
251252
*/
252253
public function registerIds($productIds)
253254
{
254255
$this->_getResource()->registerIds($this, $productIds);
255-
$this->_getSession()->unsData($this->_countCacheKey);
256+
$this->_getSession()->unsetData($this->_countCacheKey);
256257
return $this;
257258
}
258259
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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\Store\ViewModel;
10+
11+
use Magento\Framework\App\ActionInterface;
12+
use Magento\Framework\Url\EncoderInterface;
13+
use Magento\Framework\UrlInterface;
14+
use Magento\Store\Model\Store;
15+
use Magento\Store\Model\StoreManagerInterface;
16+
17+
/**
18+
* Provides target store redirect url.
19+
*/
20+
class SwitcherUrlProvider implements \Magento\Framework\View\Element\Block\ArgumentInterface
21+
{
22+
/**
23+
* @var EncoderInterface
24+
*/
25+
private $encoder;
26+
27+
/**
28+
* @var StoreManagerInterface
29+
*/
30+
private $storeManager;
31+
32+
/**
33+
* @var UrlInterface
34+
*/
35+
private $urlBuilder;
36+
37+
/**
38+
* @param EncoderInterface $encoder
39+
* @param StoreManagerInterface $storeManager
40+
* @param UrlInterface $urlBuilder
41+
*/
42+
public function __construct(
43+
EncoderInterface $encoder,
44+
StoreManagerInterface $storeManager,
45+
UrlInterface $urlBuilder
46+
) {
47+
$this->encoder = $encoder;
48+
$this->storeManager = $storeManager;
49+
$this->urlBuilder = $urlBuilder;
50+
}
51+
52+
/**
53+
* Returns target store redirect url.
54+
*
55+
* @param Store $store
56+
* @return string
57+
* @throws \Magento\Framework\Exception\NoSuchEntityException
58+
*/
59+
public function getTargetStoreRedirectUrl(Store $store): string
60+
{
61+
return $this->urlBuilder->getUrl(
62+
'stores/store/redirect',
63+
[
64+
'___store' => $store->getCode(),
65+
'___from_store' => $this->storeManager->getStore()->getCode(),
66+
ActionInterface::PARAM_NAME_URL_ENCODED => $this->encoder->encode(
67+
$store->getCurrentUrl(false)
68+
),
69+
]
70+
);
71+
}
72+
}

app/code/Magento/Store/view/frontend/templates/switch/languages.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<?php foreach ($block->getStores() as $_lang): ?>
2828
<?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
2929
<li class="view-<?= $block->escapeHtml($_lang->getCode()) ?> switcher-option">
30-
<a href="#" data-post='<?= /* @noEscape */ $block->getTargetStorePostData($_lang) ?>'>
30+
<a href="<?= $block->escapeUrl($block->getViewModel()->getTargetStoreRedirectUrl($_lang)) ?>">
3131
<?= $block->escapeHtml($_lang->getName()) ?>
3232
</a>
3333
</li>

0 commit comments

Comments
 (0)