loleaflet/src/control/Control.UserList.js |   32 +++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

New commits:
commit 4d821065b93d3c2de0f610fe4def6e3b896c5cd4
Author:     Andras Timar <andras.ti...@collabora.com>
AuthorDate: Wed Aug 19 11:19:08 2020 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Thu Aug 20 09:56:24 2020 +0200

    do not show broken images instead of avatars
    
    Change-Id: I6babd0a892dccc2ca5d6d1bf6ac6e6007411b1e2
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100977
    Tested-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit 449dc691d2d2ebcc6d81410f536b0fc04ff8b0bd)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100943
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/loleaflet/src/control/Control.UserList.js 
b/loleaflet/src/control/Control.UserList.js
index 9a7c27386..47a259eca 100644
--- a/loleaflet/src/control/Control.UserList.js
+++ b/loleaflet/src/control/Control.UserList.js
@@ -88,14 +88,16 @@ L.Control.UserList = L.Control.extend({
                if (extraInfo !== undefined && extraInfo.avatar !== undefined) {
                        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);
                        $(img).css({'background-color': color});
                }
-       
+
                nameTd.innerHTML = userName;
-       
+
                return content;
        },
 
@@ -105,7 +107,7 @@ L.Control.UserList = L.Control.extend({
                if (userlistItem == null) {
                        return;
                }
-       
+
                var count = $(userlistItem.html).find('#userlist_table tbody 
tr').length;
                if (count > 1) {
                        userlistItem.text = this.options.nUsers.replace('%n', 
count);
@@ -114,9 +116,9 @@ L.Control.UserList = L.Control.extend({
                } else {
                        userlistItem.text = this.options.noUser;
                }
-       
+
                w2ui['actionbar'].refresh();
-       
+
                var hideUserList =
                        window.ThisIsAMobileApp ||
                        (this.map['wopi'].HideUserList !== null && 
this.map['wopi'].HideUserList !== undefined &&
@@ -124,7 +126,7 @@ L.Control.UserList = L.Control.extend({
                                (window.mode.isMobile() && $.inArray('mobile', 
this.map['wopi'].HideUserList) >= 0) ||
                                (window.mode.isTablet() && $.inArray('tablet', 
this.map['wopi'].HideUserList) >= 0) ||
                                (window.mode.isDesktop() && 
$.inArray('desktop', this.map['wopi'].HideUserList) >= 0));
-       
+
                if (!hideUserList && count > 1) {
                        actionbar.show('userlist');
                        actionbar.show('userlistbreak');
@@ -139,7 +141,7 @@ L.Control.UserList = L.Control.extend({
                if (userlistItem === null) {
                        return;
                }
-       
+
                $('#user-' + e.viewId).removeClass('selected-user');
        },
 
@@ -169,10 +171,10 @@ L.Control.UserList = L.Control.extend({
                var userlistItem = w2ui['actionbar'].get('userlist');
                var username = this.escapeHtml(e.username);
                var showPopup = false;
-       
+
                if (userlistItem !== null)
                        showPopup = $(userlistItem.html).find('#userlist_table 
tbody tr').length > 0;
-       
+
                if (showPopup) {
                        $('#tb_actionbar_item_userlist')
                                .w2overlay({
@@ -188,18 +190,18 @@ L.Control.UserList = L.Control.extend({
                                that.options.userPopupTimeout = null;
                        }, 3000);
                }
-       
+
                var color = L.LOUtil.rgbToHex(this.map.getViewColor(e.viewId));
                if (e.viewId === this.map._docLayer._viewId) {
                        username = _('You');
                        color = '#000';
                }
-       
+
                // Mention readonly sessions in userlist
                if (e.readonly) {
                        username += ' (' +  _('Readonly') + ')';
                }
-       
+
                if (userlistItem !== null) {
                        var newhtml = 
$(userlistItem.html).find('#userlist_table 
tbody').append(this.getUserItem(e.viewId, username, e.extraInfo, 
color)).parent().parent()[0].outerHTML;
                        userlistItem.html = newhtml;
@@ -221,12 +223,12 @@ L.Control.UserList = L.Control.extend({
                        clearTimeout(that.options.userPopupTimeout);
                        that.options.userPopupTimeout = null;
                }, 3000);
-       
+
                if (e.viewId === this.map._docLayer._followThis) {
                        this.map._docLayer._followThis = -1;
                        this.map._docLayer._followUser = false;
                }
-       
+
                var userlistItem = w2ui['actionbar'].get('userlist');
                if (userlistItem !== null) {
                        userlistItem.html = $(userlistItem.html).find('#user-' 
+ e.viewId).remove().end()[0].outerHTML;
@@ -249,4 +251,4 @@ L.control.createUserListWidget = function () {
                '</table>' +
                '<p id="currently-msg">' + _('Current') + ' - <b><span 
id="current-editor"></span></b></p>' +
                '</div>';
-};
\ No newline at end of file
+};
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to