Expose user's settings and defaults inline

This improves performance by removing two AJAX calls and a lot of
JavaScript promises.
This commit is contained in:
Francis Lachapelle
2017-06-01 13:48:45 -04:00
parent 1fa056bb25
commit 89bfa0c536
22 changed files with 441 additions and 484 deletions
@@ -77,18 +77,15 @@
$element.off('click', toggleZoomFcn);
});
// Wait on user's defaults
Preferences.ready().then(function() {
$scope.$watch(function() { return vm.email; }, function(email, old) {
if (email && vm.urlEmail != email) {
// Email has changed or doesn't match the current URL (this happens when using md-virtual-repeat)
showGenericAvatar();
if (Preferences.defaults.SOGoGravatarEnabled)
getGravatar(email);
}
else if (!email)
showGenericAvatar();
});
$scope.$watch(function() { return vm.email; }, function(email, old) {
if (email && vm.urlEmail != email) {
// Email has changed or doesn't match the current URL (this happens when using md-virtual-repeat)
showGenericAvatar();
if (Preferences.defaults.SOGoGravatarEnabled)
getGravatar(email);
}
else if (!email)
showGenericAvatar();
});
// If sg-src is defined, watch the expression for the URL of a local image