Fixes a bug where scope.settings and globals.settings were out of sync.

Was caused by loadSettings() which assigned settings directly to globals.settings, thus breaking the reference.
This commit is contained in:
Hyzual 2015-03-26 21:22:05 +01:00
parent fb65ae48bf
commit 025be32fc7

View file

@ -37,7 +37,12 @@ angular.module('JamStash')
} }
var settings = persistence.getSettings(); var settings = persistence.getSettings();
if (settings !== undefined) { if (settings !== undefined) {
globals.settings = _(settings).omit('Url'); var updSettings = _(settings).omit('Url');
// We can't just assign settings to globals.settings because it's on the scope
// TODO: Hyz: remove $rootScope.settings and replace with individual settings
_(updSettings).each(function(val, key) {
globals.settings[key] = val;
});
} }
if (utils.getValue("SavedCollections")) { globals.SavedCollections = utils.getValue("SavedCollections").split(","); } if (utils.getValue("SavedCollections")) { globals.SavedCollections = utils.getValue("SavedCollections").split(","); }
if (utils.getValue("DefaultCollection")) { globals.DefaultCollection = utils.getValue("DefaultCollection"); } if (utils.getValue("DefaultCollection")) { globals.DefaultCollection = utils.getValue("DefaultCollection"); }