Skip to content

Commit 24b72c5

Browse files
Merge branch '2.4-develop' of github.com:magento-gl/magento2ce into ACQE-4664
2 parents 053ae32 + 4a41ec4 commit 24b72c5

File tree

54 files changed

+4206
-267
lines changed

Some content is hidden

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

54 files changed

+4206
-267
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterf
3333
private $allowedMimeTypes = [
3434
'jpg' => 'image/jpg',
3535
'jpeg' => 'image/jpeg',
36-
'gif' => 'image/png',
37-
'png' => 'image/gif'
36+
'gif' => 'image/gif',
37+
'png' => 'image/png'
3838
];
3939

4040
/**

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ public function setStore(\Magento\Store\Model\Store $store)
10261026
* Validate customer attribute values.
10271027
*
10281028
* @deprecated 100.1.0
1029+
* @see \Magento\Customer\Model\AccountManagement::validate()
10291030
* @return bool
10301031
*/
10311032
public function validate()
@@ -1286,6 +1287,8 @@ public function changeResetPasswordLinkToken($passwordLinkToken)
12861287
* Check if current reset password link token is expired
12871288
*
12881289
* @return boolean
1290+
* @deprecated
1291+
* @see \Magento\Customer\Model\AccountManagement::isResetPasswordLinkTokenExpired
12891292
*/
12901293
public function isResetPasswordLinkTokenExpired()
12911294
{
@@ -1304,12 +1307,9 @@ public function isResetPasswordLinkTokenExpired()
13041307
return true;
13051308
}
13061309

1307-
$dayDifference = floor(($currentTimestamp - $tokenTimestamp) / (24 * 60 * 60));
1308-
if ($dayDifference >= $expirationPeriod) {
1309-
return true;
1310-
}
1311-
1312-
return false;
1310+
$hourDifference = floor(($currentTimestamp - $tokenTimestamp) / (60 * 60));
1311+
1312+
return $hourDifference >= $expirationPeriod;
13131313
}
13141314

13151315
/**

app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ public function getAllOptions($withEmpty = true, $defaultValues = false)
120120
$allowedCountries = array_unique(array_merge([], ...$allowedCountries));
121121
} else {
122122
// Address can be added only for the allowed country list.
123-
$storeId = null;
123+
$websiteId = null;
124124
$customerId = $this->request->getParam('parent_id') ?? null;
125125
if ($customerId) {
126126
$customer = $this->customerRepository->getById($customerId);
127-
$storeId = $customer->getStoreId();
127+
$websiteId = $customer->getWebsiteId();
128128
}
129129

130130
$allowedCountries = $this->allowedCountriesReader->getAllowedCountries(
131131
ScopeInterface::SCOPE_WEBSITE,
132-
$storeId
132+
$websiteId
133133
);
134134
}
135135

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminEditCustomerWithAssociatedNewsletterQueueNewTest">
12+
<annotations>
13+
<stories value="Edit customer if there is associated newsletter queue new"/>
14+
<title value="Edit customer if there is associated newsletter queue new"/>
15+
<description value="Edit customer if there is associated newsletter queue new"/>
16+
<severity value="BLOCKER"/>
17+
<group value="customer"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>
21+
<createData entity="Simple_US_Customer_Multiple_Addresses_No_Default_Address" stepKey="customer"/>
22+
<magentoCron groups="index" stepKey="reindex"/>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
24+
</before>
25+
<after>
26+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
27+
28+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNewsletterGridPage">
29+
<argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/>
30+
<argument name="submenuUiId" value="{{AdminMenuMarketingCommunicationsNewsletterTemplate.dataUiId}}"/>
31+
</actionGroup>
32+
<actionGroup ref="AdminSearchNewsletterTemplateOnGridActionGroup" stepKey="findCreatedNewsletterTemplateInGrid">
33+
<argument name="name" value="{{_defaultNewsletter.name}}"/>
34+
<argument name="subject" value="{{_defaultNewsletter.subject}}"/>
35+
</actionGroup>
36+
<actionGroup ref="AdminMarketingOpenNewsletterTemplateFromGridActionGroup" stepKey="openTemplate"/>
37+
<actionGroup ref="AdminMarketingDeleteNewsletterTemplateActionGroup" stepKey="deleteTemplate"/>
38+
39+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
40+
</after>
41+
42+
<actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="openCustomersGridPage"/>
43+
<actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage">
44+
<argument name="customer" value="Simple_US_Customer_Multiple_Addresses_No_Default_Address"/>
45+
</actionGroup>
46+
<actionGroup ref="AdminSubscribeCustomerToNewsletters" stepKey="subscribeToNewsletter"/>
47+
48+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNewsletterTemplatePage">
49+
<argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/>
50+
<argument name="submenuUiId" value="{{AdminMenuMarketingCommunicationsNewsletterTemplate.dataUiId}}"/>
51+
</actionGroup>
52+
<actionGroup ref="AdminNavigateToCreateNewsletterTemplatePageActionGroup" stepKey="navigateToCreateNewsletterTemplatePage"/>
53+
<actionGroup ref="AdminCreateNewsletterTemplateActionGroup" stepKey="createNewsletterTemplate">
54+
<argument name="name" value="{{_defaultNewsletter.name}}"/>
55+
<argument name="subject" value="{{_defaultNewsletter.subject}}"/>
56+
<argument name="senderName" value="{{_defaultNewsletter.senderName}}"/>
57+
<argument name="senderEmail" value="{{_defaultNewsletter.senderEmail}}"/>
58+
<argument name="templateContent" value="{{_defaultNewsletter.textAreaContent}}"/>
59+
</actionGroup>
60+
<actionGroup ref="AdminSearchNewsletterTemplateOnGridActionGroup" stepKey="findCreatedNewsletterTemplate">
61+
<argument name="name" value="{{_defaultNewsletter.name}}"/>
62+
<argument name="subject" value="{{_defaultNewsletter.subject}}"/>
63+
</actionGroup>
64+
<actionGroup ref="AdminCreateQueueNewsletterActionGroup" stepKey="addNewsletterToQueue">
65+
<argument name="startAt" value="Dec 21, 2022 11:04:20 AM"/>
66+
</actionGroup>
67+
68+
<actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="editCustomerForm">
69+
<argument name="customer" value="Simple_US_Customer_Multiple_Addresses_No_Default_Address"/>
70+
</actionGroup>
71+
<actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressesFromActionGroup">
72+
<argument name="customerAddress" value="CustomerAddressSimple"/>
73+
</actionGroup>
74+
<actionGroup ref="AdminSaveCustomerAndAssertSuccessMessage" stepKey="saveCustomer"/>
75+
76+
</test>
77+
</tests>

app/code/Magento/Customer/Test/Mftf/Test/AdminEditCustomerWithAssociatedNewsletterQueueTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<description value="Edit customer if there is associated newsletter queue"/>
1616
<severity value="BLOCKER"/>
1717
<group value="customer"/>
18+
<skip>
19+
<issueId value="DEPRECATED">Use AdminEditCustomerWithAssociatedNewsletterQueueNewTest instead</issueId>
20+
</skip>
1821
</annotations>
1922
<before>
2023
<actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/>

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ define([
262262

263263
// process sections that can expire due to storage information inconsistency
264264
_.each(cookieSectionTimestamps, function (cookieSectionTimestamp, sectionName) {
265-
sectionData = storage.get(sectionName);
265+
if (storage !== undefined) {
266+
sectionData = storage.get(sectionName);
267+
}
266268

267269
if (typeof sectionData === 'undefined' ||
268270
typeof sectionData === 'object' &&
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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\DirectoryGraphQl\Model\Cache\Tag\Strategy\Config;
9+
10+
use Magento\DirectoryGraphQl\Model\Resolver\Country\Identity;
11+
use Magento\Framework\App\Config\ValueInterface;
12+
use Magento\Store\Model\ScopeInterface;
13+
use Magento\Store\Model\StoreManagerInterface;
14+
use Magento\Store\Model\Config\Cache\Tag\Strategy\TagGeneratorInterface;
15+
16+
/**
17+
* Generator that generates cache tags for country configuration
18+
*/
19+
class CountryTagGenerator implements TagGeneratorInterface
20+
{
21+
/**
22+
* @var string[]
23+
*/
24+
private $countryConfigPaths = [
25+
'general/locale/code',
26+
'general/country/allow'
27+
];
28+
29+
/**
30+
* @var StoreManagerInterface
31+
*/
32+
private $storeManager;
33+
34+
/**
35+
* @param StoreManagerInterface $storeManager
36+
*/
37+
public function __construct(
38+
StoreManagerInterface $storeManager
39+
) {
40+
$this->storeManager = $storeManager;
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function generateTags(ValueInterface $config): array
47+
{
48+
if (in_array($config->getPath(), $this->countryConfigPaths)) {
49+
if ($config->getScope() == ScopeInterface::SCOPE_WEBSITES) {
50+
$website = $this->storeManager->getWebsite($config->getScopeId());
51+
$storeIds = $website->getStoreIds();
52+
} elseif ($config->getScope() == ScopeInterface::SCOPE_STORES) {
53+
$storeIds = [$config->getScopeId()];
54+
} else {
55+
$storeIds = array_keys($this->storeManager->getStores());
56+
}
57+
$tags = [];
58+
foreach ($storeIds as $storeId) {
59+
$tags[] = sprintf('%s_%s', Identity::CACHE_TAG, $storeId);
60+
}
61+
return $tags;
62+
}
63+
return [];
64+
}
65+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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\DirectoryGraphQl\Model\Cache\Tag\Strategy\Config;
9+
10+
use Magento\DirectoryGraphQl\Model\Resolver\Currency\Identity;
11+
use Magento\Framework\App\Config\ValueInterface;
12+
use Magento\Store\Model\ScopeInterface;
13+
use Magento\Store\Model\StoreManagerInterface;
14+
use Magento\Store\Model\Config\Cache\Tag\Strategy\TagGeneratorInterface;
15+
16+
/**
17+
* Generator that generates cache tags for currency configuration
18+
*/
19+
class CurrencyTagGenerator implements TagGeneratorInterface
20+
{
21+
/**
22+
* @var string[]
23+
*/
24+
private $currencyConfigPaths = [
25+
'currency/options/base',
26+
'currency/options/default',
27+
'currency/options/allow',
28+
'currency/options/customsymbol'
29+
];
30+
31+
/**
32+
* @var StoreManagerInterface
33+
*/
34+
private $storeManager;
35+
36+
/**
37+
* @param StoreManagerInterface $storeManager
38+
*/
39+
public function __construct(
40+
StoreManagerInterface $storeManager
41+
) {
42+
$this->storeManager = $storeManager;
43+
}
44+
45+
/**
46+
* @inheritdoc
47+
*/
48+
public function generateTags(ValueInterface $config): array
49+
{
50+
if (in_array($config->getPath(), $this->currencyConfigPaths)) {
51+
if ($config->getScope() == ScopeInterface::SCOPE_WEBSITES) {
52+
$website = $this->storeManager->getWebsite($config->getScopeId());
53+
$storeIds = $website->getStoreIds();
54+
} elseif ($config->getScope() == ScopeInterface::SCOPE_STORES) {
55+
$storeIds = [$config->getScopeId()];
56+
} else {
57+
$storeIds = array_keys($this->storeManager->getStores());
58+
}
59+
$tags = [];
60+
foreach ($storeIds as $storeId) {
61+
$tags[] = sprintf('%s_%s', Identity::CACHE_TAG, $storeId);
62+
}
63+
return $tags;
64+
}
65+
return [];
66+
}
67+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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\DirectoryGraphQl\Model\Resolver\Country;
9+
10+
use Magento\Framework\GraphQl\Query\Resolver\IdentityInterface;
11+
use Magento\Store\Model\StoreManagerInterface;
12+
13+
class Identity implements IdentityInterface
14+
{
15+
/**
16+
* @var string
17+
*/
18+
public const CACHE_TAG = 'gql_country';
19+
20+
/**
21+
* @var StoreManagerInterface
22+
*/
23+
private $storeManager;
24+
25+
/**
26+
* @param StoreManagerInterface $storeManager
27+
*/
28+
public function __construct(StoreManagerInterface $storeManager)
29+
{
30+
$this->storeManager = $storeManager;
31+
}
32+
33+
/**
34+
* @inheritdoc
35+
*/
36+
public function getIdentities(array $resolvedData): array
37+
{
38+
if (empty($resolvedData)) {
39+
return [];
40+
}
41+
$storeId = $this->storeManager->getStore()->getId();
42+
return [self::CACHE_TAG, sprintf('%s_%s', self::CACHE_TAG, $storeId)];
43+
}
44+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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\DirectoryGraphQl\Model\Resolver\Currency;
9+
10+
use Magento\Framework\GraphQl\Query\Resolver\IdentityInterface;
11+
use Magento\Store\Model\StoreManagerInterface;
12+
13+
class Identity implements IdentityInterface
14+
{
15+
/**
16+
* @var string
17+
*/
18+
public const CACHE_TAG = 'gql_currency';
19+
20+
/**
21+
* @var StoreManagerInterface
22+
*/
23+
private $storeManager;
24+
25+
/**
26+
* @param StoreManagerInterface $storeManager
27+
*/
28+
public function __construct(StoreManagerInterface $storeManager)
29+
{
30+
$this->storeManager = $storeManager;
31+
}
32+
33+
/**
34+
* @inheritdoc
35+
*/
36+
public function getIdentities(array $resolvedData): array
37+
{
38+
if (empty($resolvedData)) {
39+
return [];
40+
}
41+
$storeId = $this->storeManager->getStore()->getId();
42+
return [self::CACHE_TAG, sprintf('%s_%s', self::CACHE_TAG, $storeId)];
43+
}
44+
}

0 commit comments

Comments
 (0)