diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 89ce2dee1d1..b0d02e5017e 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -4,6 +4,7 @@ Changelog 2020.2.0rc1 (unreleased) ------------------------ +- Restrict `geverui` cookie to admin unit. [elioschmutz] - Extend the opengever deployment directive with workspace roles. [elioschmutz] - Set seen_tours for all users in test fixture. [njohner] diff --git a/opengever/base/browser/resources/base.js b/opengever/base/browser/resources/base.js index f7ea2d85d19..894d13aae71 100644 --- a/opengever/base/browser/resources/base.js +++ b/opengever/base/browser/resources/base.js @@ -45,6 +45,7 @@ $(document).delegate('body', 'tabbedview.unknownresponse', function(event, overv * to the new gever-ui. */ function switchUI(){ - createCookie('geverui', '1'); + var pathname = new URL($('body').data('portal-url')).pathname; + Cookies.set('geverui', '1', {path: pathname, expires: 365}); window.location.reload(true); } diff --git a/opengever/base/browser/resources/js_cookie.min.js b/opengever/base/browser/resources/js_cookie.min.js new file mode 100644 index 00000000000..5bb95440202 --- /dev/null +++ b/opengever/base/browser/resources/js_cookie.min.js @@ -0,0 +1,2 @@ +// V2.2.1 - https://github.com/js-cookie/js-cookie +!function(e){var n;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var t=window.Cookies,o=window.Cookies=e();o.noConflict=function(){return window.Cookies=t,o}}}(function(){function f(){for(var e=0,n={};e + + + + + + diff --git a/opengever/core/upgrades/20200226132815_add_js_cookie/upgrade.py b/opengever/core/upgrades/20200226132815_add_js_cookie/upgrade.py new file mode 100644 index 00000000000..67bfbf2fe6f --- /dev/null +++ b/opengever/core/upgrades/20200226132815_add_js_cookie/upgrade.py @@ -0,0 +1,9 @@ +from ftw.upgrade import UpgradeStep + + +class AddJSCookie(UpgradeStep): + """Add js cookie. + """ + + def __call__(self): + self.install_upgrade_profile()