(js) Improve error handling in Preferences service

pull/27/merge
Francis Lachapelle 2016-08-11 11:59:43 -04:00
parent cc4a4f1770
commit 261a17c83b
1 changed files with 3 additions and 1 deletions

View File

@ -13,7 +13,9 @@
this.defaults = {};
this.settings = {};
this.defaultsPromise = Preferences.$$resource.fetch("jsonDefaults").then(function(data) {
this.defaultsPromise = Preferences.$$resource.fetch("jsonDefaults").then(function(response) {
var data = response || {};
// We swap $key -> _$key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)
var labels = _.fromPairs(_.map(data.SOGoMailLabelsColors, function(value, key) {
if (key.charAt(0) == '$')