summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-08 11:36:57 +0100
committerGitHub <noreply@github.com>2018-01-08 11:36:57 +0100
commita30dfc5b50440a1fc6f579d92b4d9579945802d8 (patch)
tree4f7283032216181e11c1f4ffdb7875eddf3289a1
parentecf885046459253fbe4599600db241b9e36fa61a (diff)
parentfd8f0788b1b719d1610b1865f60b8dfb4ebc1d4d (diff)
downloadnextcloud-server-a30dfc5b50440a1fc6f579d92b4d9579945802d8.tar.gz
nextcloud-server-a30dfc5b50440a1fc6f579d92b4d9579945802d8.zip
Merge pull request #7711 from nextcloud/fix-avatar-behaviour
Fix avatar display to not overwrite display style
-rw-r--r--core/js/jquery.avatar.js5
-rw-r--r--core/js/placeholder.js1
-rw-r--r--core/js/tests/specs/jquery.avatarSpec.js2
3 files changed, 2 insertions, 6 deletions
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js
index 958f0f9edd7..6da86341c1e 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 5cf7b9095ad..29f91b6698d 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));
diff --git a/core/js/tests/specs/jquery.avatarSpec.js b/core/js/tests/specs/jquery.avatarSpec.js
index bdd1fdcc163..4e13b7f26ff 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() {