From 1d0b4d0ecbadeff11e421d368465ab875effa48d Mon Sep 17 00:00:00 2001 From: fo Date: Thu, 27 Nov 2014 18:14:43 +0200 Subject: [PATCH] Fixes a bug with avatar when no id or email is sent with presence. --- avatar.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/avatar.js b/avatar.js index f1bbf1734..084d0dbf0 100644 --- a/avatar.js +++ b/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"); }