changeset d85f3d8113a7 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=d85f3d8113a7
description:
        Backed out changeset 3fdae12ed04b
diffstat:

 CHANGELOG      |   2 --
 src/sao.js     |   1 -
 src/session.js |  33 ++++++++-------------------------
 3 files changed, 8 insertions(+), 28 deletions(-)

diffs (74 lines):

diff -r 3fdae12ed04b -r d85f3d8113a7 CHANGELOG
--- a/CHANGELOG Tue May 19 18:57:53 2020 +0200
+++ b/CHANGELOG Tue May 19 19:32:20 2020 +0200
@@ -1,5 +1,3 @@
-* Keep context in sessionStorage
-* Use existing context for get_preferences
 * Allow changes to editable tree checkboxes without first selecting the line
 
 Version 5.6.0 - 2020-05-04
diff -r 3fdae12ed04b -r d85f3d8113a7 src/sao.js
--- a/src/sao.js        Tue May 19 18:57:53 2020 +0200
+++ b/src/sao.js        Tue May 19 19:32:20 2020 +0200
@@ -594,7 +594,6 @@
             jQuery('#user-logout').empty();
             jQuery('#menu').empty();
             new Sao.Window.Preferences(function() {
-                Sao.Session.current_session.reset_context();
                 Sao.get_preferences().then(function(preferences) {
                     Sao.menu(preferences);
                     Sao.user_menu(preferences);
diff -r 3fdae12ed04b -r d85f3d8113a7 src/session.js
--- a/src/session.js    Tue May 19 18:57:53 2020 +0200
+++ b/src/session.js    Tue May 19 19:32:20 2020 +0200
@@ -17,8 +17,9 @@
             this.database = database;
             this.login = login;
             this.restore();
-            this.context = {};
-            this.restore_context();
+            this.context = {
+                client: Sao.Bus.id,
+            };
             if (!Sao.Session.current_session) {
                 Sao.Session.current_session = this;
             }
@@ -81,33 +82,15 @@
         reload_context: function() {
             var args = {
                 'method': 'model.res.user.get_preferences',
-                'params': [true, this.context]
+                'params': [true, {}]
             };
-            this.reset_context();
-            var prm = Sao.rpc(args, this);
-            return prm.then(function(context) {
-                jQuery.extend(this.context, context);
-                this.store_context();
-            }.bind(this));
-        },
-        reset_context: function() {
             this.context = {
                 client: Sao.Bus.id,
             };
-        },
-        restore_context: function() {
-            this.reset_context();
-            var context = sessionStorage.getItem('sao_context_' + 
this.database);
-            if (context !== null) {
-                jQuery.extend(
-                    this.context, 
Sao.rpc.convertJSONObject(JSON.parse(context)));
-            }
-        },
-        store_context: function() {
-            var context = jQuery.extend({}, this.context);
-            delete context.client;
-            context = JSON.stringify(Sao.rpc.prepareObject(context));
-            sessionStorage.setItem('sao_context_' + this.database, context);
+            var prm = Sao.rpc(args, this);
+            return prm.then(function(context) {
+                jQuery.extend(this.context, context);
+            }.bind(this));
         },
         restore: function() {
             if (this.database && !this.session) {

Reply via email to