Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #27355 with too many cookies in admin #27364

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/code/Magento/Backend/view/adminhtml/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<argument name="bugreport_url" xsi:type="string">https://github.com/magento/magento2/issues</argument>
</arguments>
</block>

</container>
</container>
</referenceContainer>
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/Backend/view/adminhtml/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
var config = {
map: {
'*': {
'mediaUploader': 'Magento_Backend/js/media-uploader',
'mage/translate': 'Magento_Backend/js/translate'
'mediaUploader': 'Magento_Backend/js/media-uploader'
}
}
};
4 changes: 4 additions & 0 deletions app/code/Magento/Translation/Block/Js.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
*
* @api
* @since 100.0.2
* @deprecated logic was refactored in order to not use localstorage at all.
*
* You can see details in app/code/Magento/Translation/view/base/web/js/mage-translation-dictionary.js
* These block and view file were left in order to keep backward compatibility
*/
class Js extends Template
{
Expand Down
15 changes: 15 additions & 0 deletions app/code/Magento/Translation/view/base/requirejs-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

var config = {
map: {
'*': {
mageTranslationDictionary: 'Magento_Translation/js/mage-translation-dictionary'
}
},
deps: [
'mageTranslationDictionary'
]
};
61 changes: 4 additions & 57 deletions app/code/Magento/Translation/view/base/templates/translate.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,8 @@
/**
* @var \Magento\Translation\Block\Js $block
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
* @deprecated logic was refactored in order to not use localstorage at all.
*
* You can see details in app/code/Magento/Translation/view/base/web/js/mage-translation-dictionary.js
* These block and view file were left in order to keep backward compatibility
*/
?>
<!--
For frontend area dictionary file is inserted into html head in Magento/Translation/view/base/templates/dictionary.phtml
Same translation mechanism should be introduced for admin area in 2.4 version.
-->
<?php
if ($block->dictionaryEnabled()) {
$version = $block->getTranslationFileVersion();
$escapedVersion = $block->escapeJs($version);
$dictionaryFileName = /* @noEscape */ Magento\Translation\Model\Js\Config::DICTIONARY_FILE_NAME;

$scriptString = <<<script
require.config({
deps: [
'jquery',
'mage/translate',
'jquery/jquery-storageapi'
],
callback: function ($) {
'use strict';

var dependencies = [],
versionObj;

$.initNamespaceStorage('mage-translation-storage');
$.initNamespaceStorage('mage-translation-file-version');
versionObj = $.localStorage.get('mage-translation-file-version');

if (versionObj.version !== '{$escapedVersion}') {
dependencies.push(
'text!{$dictionaryFileName}'
);

}

require.config({
deps: dependencies,
callback: function (string) {
if (typeof string === 'string') {
$.mage.translate.add(JSON.parse(string));
$.localStorage.set('mage-translation-storage', string);
$.localStorage.set(
'mage-translation-file-version',
{
version: '{$escapedVersion}'
}
);
} else {
$.mage.translate.add($.localStorage.get('mage-translation-storage'));
}
}
});
}
});
script;
echo /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ var config = {
'*': {
editTrigger: 'mage/edit-trigger',
addClass: 'Magento_Translation/js/add-class',
'Magento_Translation/add-class': 'Magento_Translation/js/add-class',
mageTranslationDictionary: 'Magento_Translation/js/mage-translation-dictionary'
'Magento_Translation/add-class': 'Magento_Translation/js/add-class'
}
},
deps: [
'mage/translate-inline',
'mageTranslationDictionary'
'mage/translate-inline'
]
};