Skip to content

Commit b8704e4

Browse files
committed
ACP2E-2025: Refix ACP2E-1445 for multiple store views in the frontend.
- Fixed the CR comments.
1 parent 6523e18 commit b8704e4

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

app/code/Magento/Customer/ViewModel/Customer/Auth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class Auth implements ArgumentInterface
2121
*/
2222
public function __construct(
2323
private HttpContext $httpContext
24-
) {}
24+
) {
25+
}
2526

2627
/**
2728
* Check is user login

app/code/Magento/Customer/ViewModel/Customer/JsonSerializer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class JsonSerializer implements ArgumentInterface
2020
*/
2121
public function __construct(
2222
private Json $jsonEncoder
23-
) {}
23+
) {
24+
}
2425

2526
/**
2627
* Encode the mixed $valueToEncode into the JSON format

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use Magento\Framework\App\ObjectManager;
1212
/** @var Auth $authViewModel */
1313
$authViewModel = $block->getAuthViewModel() ?? ObjectManager::getInstance()->get(Auth::class);
1414
/** @var JsonSerializer $jsonSerializerViewModel */
15-
$jsonSerializerViewModel = $block->getJsonSerializerViewModel() ?? ObjectManager::getInstance()->get(JsonSerializer::class);
15+
$jsonSerializerViewModel = $block->getJsonSerializerViewModel() ??
16+
ObjectManager::getInstance()->get(JsonSerializer::class);
1617
$customerDataUrl = $block->getCustomerDataUrl('customer/account/updateSession');
1718
$expirableSectionNames = $block->getExpirableSectionNames();
1819
?>
@@ -22,7 +23,9 @@ $expirableSectionNames = $block->getExpirableSectionNames();
2223
"Magento_Customer/js/customer-data": {
2324
"sectionLoadUrl": "<?= $block->escapeJs($block->getCustomerDataUrl('customer/section/load')) ?>",
2425
"expirableSectionLifetime": <?= (int)$block->getExpirableSectionLifetime() ?>,
25-
"expirableSectionNames": <?= /* @noEscape */ $jsonSerializerViewModel->jsonEncode($expirableSectionNames) ?>,
26+
"expirableSectionNames": <?= /* @noEscape */ $jsonSerializerViewModel->jsonEncode(
27+
$expirableSectionNames
28+
) ?>,
2629
"cookieLifeTime": "<?= $block->escapeJs($block->getCookieLifeTime()) ?>",
2730
"updateSessionUrl": "<?= $block->escapeJs($customerDataUrl) ?>",
2831
"isLoggedIn": "<?= /* @noEscape */ $authViewModel->isLoggedIn() ?>"

app/code/Magento/PageCache/Model/App/Request/Http/IdentifierForSave.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public function __construct(
2626
private Http $request,
2727
private Context $context,
2828
private Json $serializer
29-
) {}
29+
) {
30+
}
3031

3132
/**
3233
* Return unique page identifier

app/code/Magento/PageCache/etc/frontend/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</type>
2929
<type name="Magento\Framework\App\PageCache\Kernel">
3030
<arguments>
31-
<argument name="identifier" xsi:type="object">Magento\PageCache\Model\App\Request\Http\IdentifierForSave</argument>
31+
<argument name="identifierForSave" xsi:type="object">Magento\PageCache\Model\App\Request\Http\IdentifierForSave</argument>
3232
</arguments>
3333
</type>
3434
</config>

lib/internal/Magento/Framework/App/PageCache/Kernel.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ class Kernel
6363
*/
6464
private $state;
6565

66+
/**
67+
* @var \Magento\Framework\App\PageCache\IdentifierInterface
68+
*/
69+
private $identifierForSave;
70+
6671
/**
6772
* @param Cache $cache
6873
* @param \Magento\Framework\App\PageCache\IdentifierInterface $identifier
@@ -73,6 +78,7 @@ class Kernel
7378
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
7479
* @param AppState|null $state
7580
* @param \Magento\PageCache\Model\Cache\Type|null $fullPageCache
81+
* @param \Magento\Framework\App\PageCache\IdentifierInterface $identifierForSave
7682
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
7783
*/
7884
public function __construct(
@@ -84,7 +90,8 @@ public function __construct(
8490
\Magento\Framework\App\Response\HttpFactory $httpFactory = null,
8591
\Magento\Framework\Serialize\SerializerInterface $serializer = null,
8692
AppState $state = null,
87-
\Magento\PageCache\Model\Cache\Type $fullPageCache = null
93+
\Magento\PageCache\Model\Cache\Type $fullPageCache = null,
94+
\Magento\Framework\App\PageCache\IdentifierInterface $identifierForSave = null
8895
) {
8996
$this->cache = $cache;
9097
$this->identifier = $identifier;
@@ -103,6 +110,9 @@ public function __construct(
103110
$this->fullPageCache = $fullPageCache ?? ObjectManager::getInstance()->get(
104111
\Magento\PageCache\Model\Cache\Type::class
105112
);
113+
$this->identifierForSave = $identifierForSave ?? ObjectManager::getInstance()->get(
114+
\Magento\Framework\App\PageCache\IdentifierInterface::class
115+
);
106116
}
107117

108118
/**
@@ -159,7 +169,7 @@ public function process(\Magento\Framework\App\Response\Http $response)
159169

160170
$this->fullPageCache->save(
161171
$this->serializer->serialize($this->getPreparedData($response)),
162-
$this->identifier->getValue(),
172+
$this->identifierForSave->getValue(),
163173
$tags,
164174
$maxAge
165175
);

0 commit comments

Comments
 (0)