Skip to content

Commit

Permalink
Show default placeholder if avatar image can't be fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
MorrisJobke committed Jan 20, 2016
1 parent dd733d8 commit b188de2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/js/jquery.avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -94,6 +96,7 @@
} else {
$div.hide();
}
// else an image is transferred and should be shown
} else {
$div.show();
if (ie8fix === true) {
Expand Down

0 comments on commit b188de2

Please sign in to comment.