[Libreoffice-commits] online.git: loleaflet/src

Andras Timar (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 19 20:06:57 UTC 2020


 loleaflet/src/control/Control.UserList.js |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit f513eaf5a19dab18376a1ceafbaf6700b6a48419
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Wed Aug 19 21:39:23 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Aug 19 22:06:39 2020 +0200

    do not show broken images instead of avatars, 2nd try
    
    Change-Id: Iab87518807ce11bbcf19ff8436b9241527140b7a
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101023
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/src/control/Control.UserList.js b/loleaflet/src/control/Control.UserList.js
index 949394e4f..47a259eca 100644
--- a/loleaflet/src/control/Control.UserList.js
+++ b/loleaflet/src/control/Control.UserList.js
@@ -85,19 +85,11 @@ L.Control.UserList = L.Control.extend({
 		var iconTd = L.DomUtil.create('td', 'usercolor', content);
 		var nameTd = L.DomUtil.create('td', 'username loleaflet-font', content);
 
-		var hasAvatar = false;
 		if (extraInfo !== undefined && extraInfo.avatar !== undefined) {
-			var http = new XMLHttpRequest();
-			http.open('HEAD', extraInfo.avatar, false);
-			http.send();
-			if (http.status != 404) {
-				hasAvatar = true;
-			}
-		}
-
-		if (hasAvatar) {
 			var img = L.DomUtil.create('img', 'avatar-img', iconTd);
 			img.src = extraInfo.avatar;
+			var altImg = L.LOUtil.getImageURL('user.svg');
+			img.setAttribute('onerror', 'this.onerror=null;this.src=\'' + altImg + '\';');
 			$(img).css({'border-color': color});
 		} else {
 			img = L.DomUtil.create('div', 'user-info', iconTd);


More information about the Libreoffice-commits mailing list