(js) No 404 images with contacts chips
parent
f496f2b28f
commit
904c2f071a
|
@ -8,12 +8,12 @@
|
|||
* @memberof SOGo.Common
|
||||
* @param {string} email
|
||||
* @param {number} [size] - the size of the image
|
||||
* @param {string} alternate avatar to use
|
||||
* @param {string} alternate avatar to use (none, identicon, monsterid, wavatar, retro)
|
||||
* @ngInject
|
||||
*/
|
||||
function Gravatar() {
|
||||
return function(email, size, alternate_avatar) {
|
||||
var x, y, hash, s = size;
|
||||
return function(email, size, alternate_avatar, options) {
|
||||
var x, y, hash, s = size, a = alternate_avatar;
|
||||
if (!email) {
|
||||
return '';
|
||||
}
|
||||
|
@ -28,8 +28,12 @@
|
|||
}
|
||||
hash = email.md5();
|
||||
|
||||
if (alternate_avatar == "none")
|
||||
alternate_avatar = "404";
|
||||
if (!a || a == "none") {
|
||||
if (options && options.no_404)
|
||||
alternate_avatar = "mm"; // mystery man alternative
|
||||
else
|
||||
alternate_avatar = "404";
|
||||
}
|
||||
|
||||
return 'https://www.gravatar.com/avatar/' + hash + '?s=' + s + '&d=' + alternate_avatar;
|
||||
};
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
if (!this.$$shortFormat)
|
||||
this.$$shortFormat = this.$shortFormat();
|
||||
if (!this.$$image)
|
||||
this.$$image = this.image || User.$gravatar(this.c_email, 32, User.$alternateAvatar);
|
||||
this.$$image = this.image || User.$gravatar(this.c_email, 32, User.$alternateAvatar, {no_404: true});
|
||||
|
||||
// An empty attribute to trick md-autocomplete when adding users from the ACLs editor
|
||||
this.empty = ' ';
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
if (Preferences.defaults.SOGoContactsCategories) {
|
||||
Card.$categories = Preferences.defaults.SOGoContactsCategories;
|
||||
}
|
||||
if (Preferences.defaults.SOGoAlternateAvatar)
|
||||
Card.$alternateAvatar = Preferences.defaults.SOGoAlternateAvatar;
|
||||
});
|
||||
|
||||
return Card; // return constructor
|
||||
|
@ -131,7 +133,7 @@
|
|||
if (!this.$$email)
|
||||
this.$$email = this.$preferredEmail(partial);
|
||||
if (!this.$$image)
|
||||
this.$$image = this.image || Card.$gravatar(this.$preferredEmail(partial), 32);
|
||||
this.$$image = this.image || Card.$gravatar(this.$preferredEmail(partial), 32, Card.$alternateAvatar, {no_404: true});
|
||||
this.selected = false;
|
||||
|
||||
// An empty attribute to trick md-autocomplete when adding attendees from the appointment editor
|
||||
|
|
Loading…
Reference in New Issue