Skip to content

Commit 1f27fa7

Browse files
authored
Merge branch '2.4-develop' into gift-message-fix
2 parents d373aeb + 49c6846 commit 1f27fa7

File tree

621 files changed

+30270
-594
lines changed

Some content is hidden

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

621 files changed

+30270
-594
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For more detailed information on contribution please read our [beginners guide](
2323
* Unit/integration test coverage
2424
* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
2525
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
26-
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
26+
5. All automated tests must pass.
2727

2828
## Contribution process
2929

.htaccess

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,6 @@
238238
Require all denied
239239
</IfVersion>
240240
</Files>
241-
<Files .travis.yml>
242-
<IfVersion < 2.4>
243-
order allow,deny
244-
deny from all
245-
</IfVersion>
246-
<IfVersion >= 2.4>
247-
Require all denied
248-
</IfVersion>
249-
</Files>
250241
<Files CHANGELOG.md>
251242
<IfVersion < 2.4>
252243
order allow,deny

.htaccess.sample

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,6 @@
238238
Require all denied
239239
</IfVersion>
240240
</Files>
241-
<Files .travis.yml>
242-
<IfVersion < 2.4>
243-
order allow,deny
244-
deny from all
245-
</IfVersion>
246-
<IfVersion >= 2.4>
247-
Require all denied
248-
</IfVersion>
249-
</Files>
250241
<Files CHANGELOG.md>
251242
<IfVersion < 2.4>
252243
order allow,deny

app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ public function build(array $args, bool $includeAggregation): SearchCriteriaInte
101101
}
102102

103103
if (!$searchCriteria->getSortOrders()) {
104-
$this->addDefaultSortOrder($searchCriteria, $isSearch);
104+
$this->addDefaultSortOrder($searchCriteria, $args, $isSearch);
105105
}
106106

107+
$this->addEntityIdSort($searchCriteria, $isSearch);
107108
$this->addVisibilityFilter($searchCriteria, $isSearch, !empty($args['filter']));
108109

109110
$searchCriteria->setCurrentPage($args['currentPage']);
@@ -132,6 +133,25 @@ private function addVisibilityFilter(SearchCriteriaInterface $searchCriteria, bo
132133
$this->addFilter($searchCriteria, 'visibility', $visibilityIds, 'in');
133134
}
134135

136+
/**
137+
* Add sort by Entity ID
138+
*
139+
* @param SearchCriteriaInterface $searchCriteria
140+
* @param bool $isSearch
141+
*/
142+
private function addEntityIdSort(SearchCriteriaInterface $searchCriteria, bool $isSearch): void
143+
{
144+
if ($isSearch) {
145+
return;
146+
}
147+
$sortOrderArray = $searchCriteria->getSortOrders();
148+
$sortOrderArray[] = $this->sortOrderBuilder
149+
->setField('_id')
150+
->setDirection(SortOrder::SORT_DESC)
151+
->create();
152+
$searchCriteria->setSortOrders($sortOrderArray);
153+
}
154+
135155
/**
136156
* Prepare price aggregation algorithm
137157
*
@@ -179,18 +199,32 @@ private function addFilter(
179199
* Sort by relevance DESC by default
180200
*
181201
* @param SearchCriteriaInterface $searchCriteria
202+
* @param array $args
182203
* @param bool $isSearch
183204
*/
184-
private function addDefaultSortOrder(SearchCriteriaInterface $searchCriteria, $isSearch = false): void
205+
private function addDefaultSortOrder(SearchCriteriaInterface $searchCriteria, array $args, $isSearch = false): void
185206
{
186-
$sortField = $isSearch ? 'relevance' : EavAttributeInterface::POSITION;
187-
$sortDirection = $isSearch ? SortOrder::SORT_DESC : SortOrder::SORT_ASC;
188-
$defaultSortOrder = $this->sortOrderBuilder
189-
->setField($sortField)
190-
->setDirection($sortDirection)
191-
->create();
207+
$defaultSortOrder = [];
208+
if ($isSearch) {
209+
$defaultSortOrder[] = $this->sortOrderBuilder
210+
->setField('relevance')
211+
->setDirection(SortOrder::SORT_DESC)
212+
->create();
213+
} else {
214+
$categoryIdFilter = isset($args['filter']['category_id']) ? $args['filter']['category_id'] : false;
215+
if ($categoryIdFilter) {
216+
if (!is_array($categoryIdFilter[array_key_first($categoryIdFilter)])
217+
|| count($categoryIdFilter[array_key_first($categoryIdFilter)]) <= 1
218+
) {
219+
$defaultSortOrder[] = $this->sortOrderBuilder
220+
->setField(EavAttributeInterface::POSITION)
221+
->setDirection(SortOrder::SORT_ASC)
222+
->create();
223+
}
224+
}
225+
}
192226

193-
$searchCriteria->setSortOrders([$defaultSortOrder]);
227+
$searchCriteria->setSortOrders($defaultSortOrder);
194228
}
195229

196230
/**

app/code/Magento/CatalogGraphQl/Model/Category/CategoryFilter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Exception\InputException;
1414
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1515
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\ArgumentApplier\Filter;
16+
use Magento\Framework\GraphQl\Query\Resolver\Argument\SearchCriteria\ArgumentApplier\Sort;
1617
use Magento\Search\Model\Query;
1718
use Magento\Store\Api\Data\StoreInterface;
1819
use Magento\Store\Model\ScopeInterface;
@@ -71,6 +72,7 @@ public function getResult(array $criteria, StoreInterface $store)
7172
$categoryIds = [];
7273
$criteria[Filter::ARGUMENT_NAME] = $this->formatMatchFilters($criteria['filters'], $store);
7374
$criteria[Filter::ARGUMENT_NAME][CategoryInterface::KEY_IS_ACTIVE] = ['eq' => 1];
75+
$criteria[Sort::ARGUMENT_NAME][CategoryInterface::KEY_POSITION] = ['ASC'];
7476
$searchCriteria = $this->searchCriteriaBuilder->build('categoryList', $criteria);
7577
$pageSize = $criteria['pageSize'] ?? 20;
7678
$currentPage = $criteria['currentPage'] ?? 1;

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/ProductSearch.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ private function getSortOrderArray(SearchCriteriaInterface $searchCriteria)
153153
$sortOrders = $searchCriteria->getSortOrders();
154154
if (is_array($sortOrders)) {
155155
foreach ($sortOrders as $sortOrder) {
156+
// I am replacing _id with entity_id because in ElasticSearch _id is required for sorting by ID.
157+
// Where as entity_id is required when using ID as the sort in $collection->load();.
158+
// @see \Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search::getResult
159+
if ($sortOrder->getField() === '_id') {
160+
$sortOrder->setField('entity_id');
161+
}
156162
$ordersArray[$sortOrder->getField()] = $sortOrder->getDirection();
157163
}
158164
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\CatalogGraphQl\Model\Resolver\Products\SearchResult;
1313
use Magento\CatalogGraphQl\Model\Resolver\Products\SearchResultFactory;
1414
use Magento\Framework\Api\Search\SearchCriteriaInterface;
15+
use Magento\Framework\Exception\InputException;
1516
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1617
use Magento\GraphQl\Model\Query\ContextInterface;
1718
use Magento\Search\Api\SearchInterface;
@@ -83,6 +84,7 @@ public function __construct(
8384
* @param ResolveInfo $info
8485
* @param ContextInterface $context
8586
* @return SearchResult
87+
* @throws InputException
8688
*/
8789
public function getResult(
8890
array $args,
@@ -103,7 +105,12 @@ public function getResult(
103105
//Address limitations of sort and pagination on search API apply original pagination from GQL query
104106
$searchCriteria->setPageSize($realPageSize);
105107
$searchCriteria->setCurrentPage($realCurrentPage);
106-
$searchResults = $this->productsProvider->getList($searchCriteria, $itemsResults, $queryFields, $context);
108+
$searchResults = $this->productsProvider->getList(
109+
$searchCriteria,
110+
$itemsResults,
111+
$queryFields,
112+
$context
113+
);
107114

108115
$totalPages = $realPageSize ? ((int)ceil($searchResults->getTotalCount() / $realPageSize)) : 0;
109116

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ define([
157157
regionInput = $(this.options.regionInputId),
158158
postcode = $(this.options.postcodeId),
159159
label = regionList.parent().siblings('label'),
160-
container = regionList.parents('div.field');
160+
container = regionList.parents('div.field'),
161+
regionsEntries,
162+
regionId,
163+
regionData;
161164

162165
this._clearError();
163166
this._checkRegionRequired(country);
@@ -168,8 +171,14 @@ define([
168171
// Populate state/province dropdown list if available or use input box
169172
if (this.options.regionJson[country]) {
170173
this._removeSelectOptions(regionList);
171-
$.each(this.options.regionJson[country], $.proxy(function (key, value) {
172-
this._renderSelectOption(regionList, key, value);
174+
regionsEntries = _.pairs(this.options.regionJson[country]);
175+
regionsEntries.sort(function (a, b) {
176+
return a[1].name > b[1].name ? 1 : -1;
177+
});
178+
$.each(regionsEntries, $.proxy(function (key, value) {
179+
regionId = value[0];
180+
regionData = value[1];
181+
this._renderSelectOption(regionList, regionId, regionData);
173182
}, this));
174183

175184
if (this.currentRegionOption) {
@@ -193,7 +202,7 @@ define([
193202
regionList.hide();
194203
container.hide();
195204
} else {
196-
regionList.show();
205+
regionList.removeAttr('disabled').show();
197206
}
198207
}
199208

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertOnCustomerLoginPageActionGroup">
12+
<annotations>
13+
<description>Assert on the Storefront Customer Sign-In page.</description>
14+
</annotations>
15+
16+
<seeInCurrentUrl url="{{StorefrontCustomerSignInPage.url}}" stepKey="seeOnSignInPage"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/**
77
* @api
88
*/
9-
define([], function () {
9+
define(['underscore'], function (_) {
1010
'use strict';
1111

1212
/**
@@ -44,7 +44,7 @@ define([], function () {
4444
vatId: addressData['vat_id'],
4545
sameAsBilling: addressData['same_as_billing'],
4646
saveInAddressBook: addressData['save_in_address_book'],
47-
customAttributes: addressData['custom_attributes'],
47+
customAttributes: _.toArray(addressData['custom_attributes']).reverse(),
4848

4949
/**
5050
* @return {*}

0 commit comments

Comments
 (0)