(js) Never query Gravatar.com when disabled

This commit is contained in:
Francis Lachapelle
2016-06-21 21:29:44 -04:00
parent 9dbb360ef7
commit dfc904f4f3
10 changed files with 75 additions and 28 deletions
@@ -9,6 +9,9 @@
baseURL: function() {
return ApplicationBaseURL || null;
},
resourcesURL: function() {
return ResourcesURL || null;
},
activeUser: function(param) {
var settings = {
login: UserLogin || null,
@@ -17,12 +17,11 @@
* @desc The factory we'll use to register with Angular.
* @return the User constructor
*/
User.factory = ['$q', '$log', 'sgSettings', 'Resource', 'Gravatar', function($q, $log, Settings, Resource, Gravatar) {
User.factory = ['$q', '$log', 'sgSettings', 'Resource', function($q, $log, Settings, Resource) {
angular.extend(User, {
$q: $q,
$log: $log,
$$resource: new Resource(Settings.activeUser('folderURL'), Settings.activeUser()),
$gravatar: Gravatar,
$query: '',
$users: []
});
@@ -114,7 +113,9 @@
if (!this.$$shortFormat)
this.$$shortFormat = this.$shortFormat();
if (!this.$$image)
this.$$image = this.image || User.$gravatar(this.c_email, 32, User.$alternateAvatar, {no_404: true});
this.$$image = this.image;
// NOTE: We can't assign a Gravatar at this stage since we would need the Preferences module
// which already depend on the User module.
// An empty attribute to trick md-autocomplete when adding users from the ACLs editor
this.empty = ' ';