From 3163faa5e32be433315a3148ff420d97d28acab9 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 22 Oct 2013 16:27:46 +0200 Subject: [PATCH] on load, make sure user.ui.itemSort and user.ui.itemView are valid (itemKey or itemView may have been removed) - fixes #1874 --- static/js/pandora.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/static/js/pandora.js b/static/js/pandora.js index a33a3f50..62d34c35 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -265,6 +265,20 @@ appPanel delete pandora.user.ui[key]; } }); + // make sure itemSort is valid + if (!Ox.contains(pandora.site.itemKeys.filter(function(itemKey) { + return itemKey.sort; + }).map(function(itemKey) { + return itemKey.id; + }), pandora.user.ui.itemSort[0].key)) { + pandora.user.ui.itemSort = pandora.site.user.ui.itemSort; + } + // make sure itemView is valid + if (!Ox.contains(pandora.site.itemViews.map(function(itemView) { + return itemView.id; + }), pandora.user.ui.itemView)) { + pandora.user.ui.itemView = pandora.site.user.ui.itemView; + } // patch theme ... this can be removed at a later point pandora.user.ui.theme = legacyThemes[pandora.user.ui.theme] || pandora.user.ui.theme; // make sure theme is valid