Skip to content

Commit 90d7995

Browse files
committed
Merge branch '2.4-develop' into L3_PR_21-12-10
2 parents a117583 + 9b1016b commit 90d7995

File tree

23 files changed

+898
-111
lines changed

23 files changed

+898
-111
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Representation of Webapi module in System Configuration (Magento admin panel).
5+
*
6+
* Copyright © Magento, Inc. All rights reserved.
7+
* See COPYING.txt for license details.
8+
*/
9+
-->
10+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
11+
<system>
12+
<section id="webapi">
13+
<group id="graphql_validation" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
14+
<label>GraphQl Input Limits</label>
15+
<field id="input_limit_enabled" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
16+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
17+
<label>Enable Input Limits</label>
18+
<config_path>graphql/validation/input_limit_enabled</config_path>
19+
</field>
20+
<field id="maximum_page_size" translate="label comment" type="text" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
21+
<label>Maximum Page Size</label>
22+
<comment>Maximum number of items allowed in a paginated search result.</comment>
23+
<config_path>graphql/validation/maximum_page_size</config_path>
24+
<depends>
25+
<field id="input_limit_enabled">1</field>
26+
</depends>
27+
</field>
28+
</group>
29+
</section>
30+
</system>
31+
</config>
32+

app/code/Magento/ReleaseNotification/Model/Condition/CanViewNotification.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ public function isVisible(array $arguments)
8282
$value = $this->cacheStorage->load($cacheKey);
8383

8484
if ($value === false) {
85-
$value = version_compare(
86-
$this->viewerLogger->get($userId)->getLastViewVersion(),
87-
$this->productMetadata->getVersion(),
88-
'<'
89-
);
85+
$lastViewVersion = $this->viewerLogger->get($userId)->getLastViewVersion();
86+
$value = ($lastViewVersion) ?
87+
version_compare($lastViewVersion, $this->productMetadata->getVersion(), '<') : true;
9088
$this->cacheStorage->save(false, $cacheKey);
9189
}
9290
return (bool)$value;

app/code/Magento/ReleaseNotification/Test/Unit/Model/Condition/CanViewNotificationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testIsVisible($expected, $version, $lastViewVersion)
9898
$this->sessionMock->expects($this->once())
9999
->method('getId')
100100
->willReturn(1);
101-
$this->productMetadataMock->expects($this->once())
101+
$this->productMetadataMock->expects($this->any())
102102
->method('getVersion')
103103
->willReturn($version);
104104
$this->logMock->expects($this->once())
@@ -122,7 +122,7 @@ public function isVisibleProvider()
122122
return [
123123
[false, '2.2.1-dev', '999.999.999-alpha'],
124124
[true, '2.2.1-dev', '2.0.0'],
125-
[true, '2.2.1-dev', '2.2.0'],
125+
[true, '2.2.1-dev', null],
126126
[false, '2.2.1-dev', '2.2.1'],
127127
[true, '2.2.1-dev', '2.2.0'],
128128
[true, '2.3.0', '2.2.0'],

app/code/Magento/Webapi/etc/adminhtml/system.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@
2020
<comment>If empty, UTF-8 will be used.</comment>
2121
</field>
2222
</group>
23+
<group id="validation" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
24+
<label>Web Api Input Limits</label>
25+
<field id="input_limit_enabled" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
26+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
27+
<label>Enable Input Limits</label>
28+
</field>
29+
<field id="complex_array_limit" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
30+
<label>Input List Limit</label>
31+
<comment>Maximum number of items allowed in an entity's array property.</comment>
32+
<depends>
33+
<field id="input_limit_enabled">1</field>
34+
</depends>
35+
</field>
36+
<field id="maximum_page_size" translate="label comment" type="text" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
37+
<label>Maximum Page Size</label>
38+
<comment>Maximum number of items allowed in a paginated search result.</comment>
39+
<depends>
40+
<field id="input_limit_enabled">1</field>
41+
</depends>
42+
</field>
43+
<field id="default_page_size" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
44+
<label>Default Page Size</label>
45+
<comment>Default number of items a paginated search result.</comment>
46+
</field>
47+
</group>
2348
</section>
2449
</system>
2550
</config>

app/code/Magento/Widget/Model/ResourceModel/Widget/Instance.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ protected function _afterSave(AbstractModel $object)
8989
if (in_array($pageGroup['page_id'], $pageIds)) {
9090
$connection->update($pageTable, $data, ['page_id = ?' => (int)$pageId]);
9191
} else {
92+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
9293
$connection->insert($pageTable, array_merge(['instance_id' => $object->getId()], $data));
9394
$pageId = $connection->lastInsertId($pageTable);
9495
}
@@ -124,7 +125,7 @@ protected function _saveLayoutUpdates($widgetInstance, $pageGroupData)
124125
$pageGroupData['template']
125126
);
126127
$insert = ['handle' => $handle, 'xml' => $xml];
127-
if (strlen($widgetInstance->getSortOrder())) {
128+
if ($widgetInstance->getSortOrder() !== null && strlen($widgetInstance->getSortOrder())) {
128129
$insert['sort_order'] = $widgetInstance->getSortOrder();
129130
}
130131

@@ -147,6 +148,7 @@ protected function _saveLayoutUpdates($widgetInstance, $pageGroupData)
147148

148149
/**
149150
* Prepare store ids.
151+
*
150152
* If one of store id is default (0) return all store ids
151153
*
152154
* @param array $storeIds
@@ -162,6 +164,7 @@ protected function _prepareStoreIds($storeIds)
162164

163165
/**
164166
* Perform actions before object delete.
167+
*
165168
* Collect page ids and layout update ids and set to object for further delete
166169
*
167170
* @param \Magento\Framework\Model\AbstractModel $object
@@ -188,6 +191,7 @@ protected function _beforeDelete(AbstractModel $object)
188191

189192
/**
190193
* Perform actions after object delete.
194+
*
191195
* Delete layout updates by layout update ids collected in _beforeSave
192196
*
193197
* @param \Magento\Widget\Model\Widget\Instance $object

composer.lock

Lines changed: 43 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ArgumentsReader
1414
{
1515
use GetParameterClassTrait;
1616

17-
const NO_DEFAULT_VALUE = 'NO-DEFAULT';
17+
public const NO_DEFAULT_VALUE = 'NO-DEFAULT';
1818

1919
/**
2020
* @var NamespaceResolver
@@ -110,7 +110,11 @@ private function processType(\ReflectionClass $class, \Laminas\Code\Reflection\P
110110

111111
$type = $parameter->detectType();
112112

113-
if ($type === 'null') {
113+
/**
114+
* $type === null if it is unspecified
115+
* $type === 'null' if it is used in doc block
116+
*/
117+
if ($type === null || $type === 'null') {
114118
return null;
115119
}
116120

0 commit comments

Comments
 (0)