Skip to content

Commit b7aa83d

Browse files
committed
Merge remote-tracking branch 'origin/AC-3162-p15' into delivery-bunch-w22
2 parents 5940a90 + 4ff432c commit b7aa83d

File tree

38 files changed

+1303
-109
lines changed

38 files changed

+1303
-109
lines changed

app/code/Magento/AdobeIms/Model/GetAccessToken.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ public function execute(int $adminUserId = null): ?string
5555
{
5656
try {
5757
$adminUserId = $adminUserId ?? (int) $this->userContext->getUserId();
58-
return $this->encryptor->decrypt(
59-
$this->userProfileRepository->getByUserId($adminUserId)->getAccessToken()
60-
);
58+
return $this->userProfileRepository->getByUserId($adminUserId)->getAccessToken();
6159
} catch (NoSuchEntityException $exception) {
6260
return null;
6361
}

app/code/Magento/AdobeIms/Test/Unit/Model/GetAccessTokenTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ public function testExecute(?string $token): void
7272
->willReturn($userProfileMock);
7373
$userProfileMock->expects($this->once())->method('getAccessToken')->willReturn($token);
7474

75-
$decryptedToken = $token ?? '';
76-
77-
$this->encryptor->expects($this->once())
78-
->method('decrypt')
79-
->with($token)
80-
->willReturn($decryptedToken);
81-
8275
$this->assertEquals($token, $this->getAccessToken->execute());
8376
}
8477

app/code/Magento/Backend/Test/Mftf/Test/AdminPrivacyPolicyTest.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<closeAdminNotification stepKey="closeAdminNotification"/>
2626
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkDashboard">
2727
<argument name="text" value="Privacy Policy"/>
28-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
28+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
2929
</actionGroup>
3030
<!-- Checking for Privacy policy footer in salesOrderPage -->
3131
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesOrder">
@@ -34,7 +34,7 @@
3434
</actionGroup>
3535
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSalesOrder">
3636
<argument name="text" value="Privacy Policy"/>
37-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
37+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
3838
</actionGroup>
3939
<!-- Checking for Privacy policy footer in catalogProductsPage -->
4040
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogProducts">
@@ -43,7 +43,7 @@
4343
</actionGroup>
4444
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCatalogProducts">
4545
<argument name="text" value="Privacy Policy"/>
46-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
46+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
4747
</actionGroup>
4848
<!-- Checking for Privacy policy footer in customersAllCustomersPage -->
4949
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCustomersAllCustomers">
@@ -52,7 +52,7 @@
5252
</actionGroup>
5353
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCustomersAllCustomers">
5454
<argument name="text" value="Privacy Policy"/>
55-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
55+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
5656
</actionGroup>
5757
<!-- Checking for Privacy policy footer in marketingCatalogPriceRulePage -->
5858
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingCatalogPriceRule">
@@ -61,7 +61,7 @@
6161
</actionGroup>
6262
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule">
6363
<argument name="text" value="Privacy Policy"/>
64-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
64+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
6565
</actionGroup>
6666
<!-- Checking for Privacy policy footer in contentBlocksPage -->
6767
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentBlocks">
@@ -70,7 +70,7 @@
7070
</actionGroup>
7171
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkContentBlocks">
7272
<argument name="text" value="Privacy Policy"/>
73-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
73+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
7474
</actionGroup>
7575
<!-- Checking for Privacy policy footer in reportSearcbTermsPage -->
7676
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsSearchTerms">
@@ -79,7 +79,7 @@
7979
</actionGroup>
8080
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkReportsSearchTerms">
8181
<argument name="text" value="Privacy Policy"/>
82-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
82+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
8383
</actionGroup>
8484
<!-- Checking for Privacy policy footer in storesAllStoresPage -->
8585
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresAllStores">
@@ -88,7 +88,7 @@
8888
</actionGroup>
8989
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkStoresAllStores">
9090
<argument name="text" value="Privacy Policy"/>
91-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
91+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
9292
</actionGroup>
9393
<!-- Checking for Privacy policy footer in systemImportPage -->
9494
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemImport">
@@ -97,7 +97,7 @@
9797
</actionGroup>
9898
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSystemImport">
9999
<argument name="text" value="Privacy Policy"/>
100-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
100+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
101101
</actionGroup>
102102
<!-- Checking for Privacy policy footer in findPartnersAndExtensionsPage -->
103103
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToFindPartnersAndExtensions">
@@ -106,7 +106,7 @@
106106
</actionGroup>
107107
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions">
108108
<argument name="text" value="Privacy Policy"/>
109-
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
109+
<argument name="url" value="https://www.adobe.com/privacy/policy.html"/>
110110
</actionGroup>
111111
</test>
112112
</tests>

app/code/Magento/Backend/view/adminhtml/layout/default.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<block class="Magento\Backend\Block\Page\Footer" name="version" as="version" />
6464
<block class="Magento\Framework\View\Element\Template" name="privacyPolicy" as="privacyPolicy" template="Magento_Backend::page/privacyPolicy.phtml">
6565
<arguments>
66-
<argument name="privacypolicy_url" xsi:type="string">https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf</argument>
66+
<argument name="privacypolicy_url" xsi:type="string">https://www.adobe.com/privacy/policy.html</argument>
6767
</arguments>
6868
</block>
6969
<block class="Magento\Framework\View\Element\Template" name="report" as="report" template="Magento_Backend::page/report.phtml">

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\DB\Query\Generator as QueryGenerator;
1414
use Magento\Framework\DB\Select;
1515
use Magento\Framework\EntityManager\MetadataPool;
16+
use Magento\Store\Api\Data\StoreInterface;
1617
use Magento\Store\Model\Store;
1718

1819
// phpcs:disable Magento2.Classes.AbstractApi
@@ -126,9 +127,9 @@ abstract class AbstractAction
126127
private $queryGenerator;
127128

128129
/**
129-
* @var int
130+
* @var StoreInterface
130131
*/
131-
private $currentStoreId = 0;
132+
private $currentStore;
132133

133134
/**
134135
* @param ResourceConnection $resource
@@ -171,14 +172,36 @@ protected function reindex()
171172
{
172173
foreach ($this->storeManager->getStores() as $store) {
173174
if ($this->getPathFromCategoryId($store->getRootCategoryId())) {
174-
$this->currentStoreId = $store->getId();
175+
$this->setCurrentStore($store);
175176
$this->reindexRootCategory($store);
176177
$this->reindexAnchorCategories($store);
177178
$this->reindexNonAnchorCategories($store);
178179
}
179180
}
180181
}
181182

183+
/**
184+
* Set current store
185+
*
186+
* @param StoreInterface $store
187+
* @return $this
188+
*/
189+
private function setCurrentStore(StoreInterface $store): self
190+
{
191+
$this->currentStore = $store;
192+
return $this;
193+
}
194+
195+
/**
196+
* Get current store
197+
*
198+
* @return StoreInterface
199+
*/
200+
private function getCurrentStore(): StoreInterface
201+
{
202+
return $this->currentStore;
203+
}
204+
182205
/**
183206
* Return validated table name
184207
*
@@ -484,6 +507,7 @@ protected function hasAnchorSelect(Store $store)
484507
*/
485508
protected function createAnchorSelect(Store $store)
486509
{
510+
$this->setCurrentStore($store);
487511
$isAnchorAttributeId = $this->config->getAttribute(
488512
\Magento\Catalog\Model\Category::ENTITY,
489513
'is_anchor'
@@ -690,7 +714,7 @@ protected function fillTempCategoryTreeIndex($temporaryName)
690714
['ccacs' => $this->getTable('catalog_category_entity_int')],
691715
'ccacs.' . $categoryLinkField . ' = c.' . $categoryLinkField
692716
. ' AND ccacs.attribute_id = ccacd.attribute_id AND ccacs.store_id = ' .
693-
$this->currentStoreId,
717+
$this->getCurrentStore()->getId(),
694718
[]
695719
)->where(
696720
$this->connection->getIfNullSql('ccacs.value', 'ccacd.value') . ' = ?',
@@ -702,8 +726,14 @@ protected function fillTempCategoryTreeIndex($temporaryName)
702726
foreach ($selects as $select) {
703727
$values = [];
704728

705-
foreach ($this->connection->fetchAll($select) as $category) {
706-
foreach (explode('/', $category['path']) as $parentId) {
729+
$categories = $this->connection->fetchAll($select);
730+
foreach ($categories as $category) {
731+
$categoriesTree = explode('/', $category['path']);
732+
foreach ($categoriesTree as $parentId) {
733+
if (!in_array($this->getCurrentStore()->getRootCategoryId(), $categoriesTree, true)) {
734+
break;
735+
}
736+
707737
if ($parentId !== $category['entity_id']) {
708738
$values[] = [$parentId, $category['entity_id']];
709739
}
@@ -717,7 +747,7 @@ protected function fillTempCategoryTreeIndex($temporaryName)
717747
}
718748

719749
/**
720-
* Retrieve select for reindex products of non anchor categories
750+
* Retrieve select for reindex products of anchor categories
721751
*
722752
* @param Store $store
723753
* @return Select

app/code/Magento/Catalog/Model/ResourceModel/Collection/AbstractCollection.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Catalog\Model\ResourceModel\Collection;
77

8+
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
9+
use Magento\Framework\Exception\LocalizedException;
10+
811
/**
912
* Catalog EAV collection resource abstract model
1013
*
@@ -25,7 +28,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo
2528
protected $_storeId;
2629

2730
/**
28-
* Store manager
31+
* Manager of store
2932
*
3033
* @var \Magento\Store\Model\StoreManagerInterface
3134
*/
@@ -155,6 +158,18 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
155158
$entityIdField = $indexList[$connection->getPrimaryKeyName($entityTable)]['COLUMNS_LIST'][0];
156159

157160
if ($storeId) {
161+
162+
foreach ($attributeIds as $id) {
163+
$attribute = $this->_eavConfig->getAttribute(
164+
$this->getEntity()->getType(),
165+
$id
166+
);
167+
168+
if ($attribute->getAttributeCode() === 'price' && (int)$attribute->getIsGlobal() === 1) {
169+
$storeId = $this->getDefaultStoreId();
170+
}
171+
}
172+
158173
$joinCondition = [
159174
't_s.attribute_id = t_d.attribute_id',
160175
"t_s.{$entityIdField} = t_d.{$entityIdField}",

app/code/Magento/CatalogGraphQl/Model/Config/AttributeReader.php

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,61 @@
66

77
namespace Magento\CatalogGraphQl\Model\Config;
88

9+
use Magento\Catalog\Model\Product;
10+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
11+
use Magento\CatalogGraphQl\Model\Resolver\Products\Attributes\Collection;
12+
use Magento\EavGraphQl\Model\Resolver\Query\Type;
13+
use Magento\Framework\App\Config\ScopeConfigInterface;
914
use Magento\Framework\Config\ReaderInterface;
1015
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1116
use Magento\Framework\GraphQl\Schema\Type\Entity\MapperInterface;
1217
use Magento\Framework\Reflection\TypeProcessor;
13-
use Magento\EavGraphQl\Model\Resolver\Query\Type;
14-
use Magento\CatalogGraphQl\Model\Resolver\Products\Attributes\Collection;
18+
use Magento\Store\Model\ScopeInterface;
1519

1620
/**
1721
* Adds custom/eav attribute to Catalog product types in the GraphQL config.
1822
*/
1923
class AttributeReader implements ReaderInterface
2024
{
25+
public const XML_PATH_INCLUDE_DYNAMIC_ATTRIBUTES =
26+
'web_api/graphql/include_dynamic_attributes_as_entity_type_fields';
27+
2128
/**
2229
* @var MapperInterface
2330
*/
24-
private $mapper;
31+
private MapperInterface $mapper;
2532

2633
/**
2734
* @var Type
2835
*/
29-
private $typeLocator;
36+
private Type $typeLocator;
3037

3138
/**
3239
* @var Collection
3340
*/
34-
private $collection;
41+
private Collection $collection;
42+
43+
/**
44+
* @var ScopeConfigInterface
45+
*/
46+
private ScopeConfigInterface $config;
3547

3648
/**
3749
* @param MapperInterface $mapper
3850
* @param Type $typeLocator
3951
* @param Collection $collection
52+
* @param ScopeConfigInterface $config
4053
*/
4154
public function __construct(
4255
MapperInterface $mapper,
4356
Type $typeLocator,
44-
Collection $collection
57+
Collection $collection,
58+
ScopeConfigInterface $config
4559
) {
4660
$this->mapper = $mapper;
4761
$this->typeLocator = $typeLocator;
4862
$this->collection = $collection;
63+
$this->config = $config;
4964
}
5065

5166
/**
@@ -58,22 +73,25 @@ public function __construct(
5873
*/
5974
public function read($scope = null) : array
6075
{
61-
$typeNames = $this->mapper->getMappedTypes(\Magento\Catalog\Model\Product::ENTITY);
62-
$config =[];
63-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
64-
foreach ($this->collection->getAttributes() as $attribute) {
65-
$attributeCode = $attribute->getAttributeCode();
66-
$locatedType = $this->typeLocator->getType(
67-
$attributeCode,
68-
\Magento\Catalog\Model\Product::ENTITY
69-
) ?: 'String';
70-
$locatedType = $locatedType === TypeProcessor::NORMALIZED_ANY_TYPE ? 'String' : ucfirst($locatedType);
71-
foreach ($typeNames as $typeName) {
72-
$config[$typeName]['fields'][$attributeCode] = [
73-
'name' => $attributeCode,
74-
'type' => $locatedType,
75-
'arguments' => []
76-
];
76+
$config = [];
77+
78+
if ($this->config->isSetFlag(self::XML_PATH_INCLUDE_DYNAMIC_ATTRIBUTES, ScopeInterface::SCOPE_STORE)) {
79+
$typeNames = $this->mapper->getMappedTypes(Product::ENTITY);
80+
81+
/** @var Attribute $attribute */
82+
foreach ($this->collection->getAttributes() as $attribute) {
83+
$attributeCode = $attribute->getAttributeCode();
84+
$locatedType = $this->typeLocator->getType($attributeCode, Product::ENTITY) ?: 'String';
85+
$locatedType = TypeProcessor::NORMALIZED_ANY_TYPE === $locatedType ? 'String' : ucfirst($locatedType);
86+
87+
foreach ($typeNames as $typeName) {
88+
$config[$typeName]['fields'][$attributeCode] = [
89+
'name' => $attributeCode,
90+
'type' => $locatedType,
91+
'arguments' => [],
92+
'deprecated' => ['reason' => 'Use the `custom_attributes` field instead.'],
93+
];
94+
}
7795
}
7896
}
7997

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductCategories.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ public function getCategoryIdsByProduct(int $productId, int $storeId)
6868
->joinInner(['store' => $storeTable], $connection->quoteInto('store.store_id = ?', $storeId), [])
6969
->joinInner(
7070
['store_group' => $storeGroupTable],
71-
'store.group_id = store_group.group_id AND cat_index.category_id != store_group.root_category_id',
72-
[]
71+
$connection->quoteInto(
72+
'store.group_id = store_group.group_id AND NOT EXISTS
73+
(SELECT 1 FROM store_group WHERE cat_index.category_id IN (store_group.root_category_id)
74+
and cat_index.product_id = ?)',
75+
$productId,
76+
\Zend_Db::INT_TYPE
77+
),
7378
)
7479
->where('product_id = ?', $productId);
7580

76-
$categoryIds = $connection->fetchCol($select);
77-
78-
return $categoryIds;
81+
return $connection->fetchCol($select);
7982
}
8083

8184
/**

0 commit comments

Comments
 (0)