From 0323ed4c8b535e3525ac23d1fe076650e4f813f1 Mon Sep 17 00:00:00 2001 From: Daryl Hedley Date: Thu, 7 May 2015 13:45:22 +0100 Subject: [PATCH] Changed user preferences to be session based fixes #663 --- frontend/src/core/app/views/originView.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/core/app/views/originView.js b/frontend/src/core/app/views/originView.js index 92fc6b2b9b..452ad82a01 100644 --- a/frontend/src/core/app/views/originView.js +++ b/frontend/src/core/app/views/originView.js @@ -54,13 +54,11 @@ define(function(require){ setUserPreference: function(key, value) { if (this.settings.preferencesKey && typeof(Storage) !== "undefined") { // Get preferences for this view - var preferences = localStorage.getItem(this.settings.preferencesKey); - // Convert string to JSON - var json = (JSON.parse(preferences) || {}); + var preferences = (Origin.sessionModel.get(this.settings.preferencesKey) || {}); // Set key and value - json[key] = value; + preferences[key] = value; // Store in localStorage - localStorage.setItem(this.settings.preferencesKey, JSON.stringify(json)); + Origin.sessionModel.set(this.settings.preferencesKey, preferences); } }, @@ -68,7 +66,7 @@ define(function(require){ getUserPreferences: function() { if (this.settings.preferencesKey && typeof(Storage) !== "undefined" && localStorage.getItem(this.settings.preferencesKey)) { - return JSON.parse(localStorage.getItem(this.settings.preferencesKey)); + return Origin.sessionModel.get(this.settings.preferencesKey); } else { return {}; }