diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-01-20 15:18:57 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-01-20 15:18:57 +0100 |
commit | b188de242ec7e2f0d00cc47218107ea3fc60fd72 (patch) | |
tree | d2eead1a9378ce575cb4f12a0471fd07f2110dd4 /core | |
parent | dd733d89256e0a2d1f7f4f96ac46b5a7bfbff984 (diff) | |
download | nextcloud-server-b188de242ec7e2f0d00cc47218107ea3fc60fd72.tar.gz nextcloud-server-b188de242ec7e2f0d00cc47218107ea3fc60fd72.zip |
Show default placeholder if avatar image can't be fetched
* fixes owncloud/documents#601
* ref #14564
Diffstat (limited to 'core')
-rw-r--r-- | core/js/jquery.avatar.js | 7 |
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) { |