summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-25 10:01:23 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-25 10:01:23 +0100
commit44043cb1d715a19ec95a4987827c3201aa1fb13f (patch)
tree561cb7041a1cf14995b9c53931f595eac507cf62 /core/js
parentef4fca22d1c1c28aa499c12d0600e29e318523b0 (diff)
parentb188de242ec7e2f0d00cc47218107ea3fc60fd72 (diff)
downloadnextcloud-server-44043cb1d715a19ec95a4987827c3201aa1fb13f.tar.gz
nextcloud-server-44043cb1d715a19ec95a4987827c3201aa1fb13f.zip
Merge pull request #21811 from owncloud/fix-unauthenticated-avatar
Show default placeholder if avatar image can't be fetched
Diffstat (limited to 'core/js')
-rw-r--r--core/js/jquery.avatar.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js
index 7e97550ba17..d87c234e14e 100644
--- a/core/js/jquery.avatar.js
+++ b/core/js/jquery.avatar.js
@@ -81,8 +81,10 @@
// If the displayname is not defined we use the old code path
if (typeof(displayname) === 'undefined') {
- $.get(url, function(result) {
- if (typeof(result) === 'object') {
+ $.get(url).always(function(result, status) {
+ // if there is an error or an object returned (contains user information):
+ // -> show the fallback placeholder
+ if (typeof(result) === 'object' || status === 'error') {
if (!hidedefault) {
if (result.data && result.data.displayname) {
$div.imageplaceholder(user, result.data.displayname);
@@ -94,6 +96,7 @@
} else {
$div.hide();
}
+ // else an image is transferred and should be shown
} else {
$div.show();
if (ie8fix === true) {