Fixes a bug with avatar when no id or email is sent with presence.

pull/201/merge
fo 10 years ago
parent 1d4177faeb
commit 1d0b4d0ecb
  1. 9
      avatar.js

@ -14,7 +14,7 @@ var Avatar = (function(my) {
}
users[jid] = id;
}
var url = getGravatarUrl(users[jid]);
var url = getGravatarUrl(users[jid] || jid);
var resourceJid = Strophe.getResourceFromJid(jid);
var thumbnail = $('#participant_' + resourceJid);
var avatar = $('#avatar_' + resourceJid);
@ -128,9 +128,12 @@ var Avatar = (function(my) {
return mediaStreams[jid][MediaStream.VIDEO_TYPE].muted;
}
function getGravatarUrl(email, size) {
function getGravatarUrl(id, size) {
if(id === connection.emuc.myroomjid) {
id = SettingsMenu.getUID();
}
return 'https://www.gravatar.com/avatar/' +
(email ? MD5.hexdigest(email.trim().toLowerCase()) : SettingsMenu.getUID()) +
MD5.hexdigest(id.trim().toLowerCase()) +
"?d=retro&size=" + (size || "30");
}

Loading…
Cancel
Save