on load, make sure user.ui.itemSort and user.ui.itemView are valid (itemKey or itemView may have been removed) - fixes #1874

This commit is contained in:
rolux 2013-10-22 16:27:46 +02:00
parent 967125cca7
commit 3163faa5e3

View file

@ -265,6 +265,20 @@ appPanel
delete pandora.user.ui[key]; 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 // patch theme ... this can be removed at a later point
pandora.user.ui.theme = legacyThemes[pandora.user.ui.theme] || pandora.user.ui.theme; pandora.user.ui.theme = legacyThemes[pandora.user.ui.theme] || pandora.user.ui.theme;
// make sure theme is valid // make sure theme is valid