From 04a18098e458bccfe632e4e30d879d87d2b60d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 5 Jan 2018 11:47:03 +0100 Subject: [PATCH 1/2] Remove show() function since we always show the avatar container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/js/jquery.avatar.js | 5 +---- core/js/placeholder.js | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index 958f0f9edd..6da86341c1 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -110,9 +110,8 @@ // If the new image loads successfully set it. img.onload = function() { - $div.text(''); - $div.append(img); $div.clearimageplaceholder(); + $div.append(img); if(typeof callback === 'function') { callback(); @@ -127,7 +126,6 @@ $div.imageplaceholder(user, displayname); } else { setAvatarForUnknownUser($div); - $div.removeClass('icon-loading'); } if(typeof callback === 'function') { @@ -136,7 +134,6 @@ }; $div.addClass('icon-loading'); - $div.show(); img.width = size; img.height = size; img.src = url; diff --git a/core/js/placeholder.js b/core/js/placeholder.js index 5cf7b9095a..29f91b6698 100644 --- a/core/js/placeholder.js +++ b/core/js/placeholder.js @@ -156,6 +156,7 @@ this.css('text-align', ''); this.css('line-height', ''); this.css('font-size', ''); + this.html(''); this.removeClass('icon-loading'); }; }(jQuery)); From fd8f0788b1b719d1610b1865f60b8dfb4ebc1d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 8 Jan 2018 10:35:32 +0100 Subject: [PATCH 2/2] Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The avatar plugin should not change the display element, since the avatar is always shown by default and the display value is up to the developers Signed-off-by: Julius Härtl --- core/js/tests/specs/jquery.avatarSpec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/js/tests/specs/jquery.avatarSpec.js b/core/js/tests/specs/jquery.avatarSpec.js index bdd1fdcc16..4e13b7f26f 100644 --- a/core/js/tests/specs/jquery.avatarSpec.js +++ b/core/js/tests/specs/jquery.avatarSpec.js @@ -202,8 +202,6 @@ describe('jquery.avatar tests', function() { expect(window.Image().height).toEqual(32); expect(window.Image().width).toEqual(32); expect(window.Image().src).toEqual('http://localhost/index.php/avatar/foo/32'); - - expect($div.css('display')).toEqual('block'); }); it('callback called', function() {