UX: preloaded gravatar was appearing on the right instead of the left

This commit is contained in:
Régis Hanol 2017-11-29 12:04:35 +01:00
parent 9fbe1436b6
commit 1218ead355
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,10 @@
import { htmlHelper } from 'discourse-common/lib/helpers';
import { avatarImg } from 'discourse/lib/utilities';
export default htmlHelper((avatarTemplate, size) => avatarImg({ size, avatarTemplate }));
export default htmlHelper((avatarTemplate, size) => {
if (Ember.isEmpty(avatarTemplate)) {
return "<div class='avatar-placeholder'></div>";
} else {
return avatarImg({ size, avatarTemplate });
}
});

View File

@ -87,7 +87,7 @@ class UserAvatarsController < ApplicationController
return render_blank if version != OptimizedImage::VERSION
upload_id = upload_id.to_i
return render_blank unless upload_id > 0 && user_avatar = user.user_avatar
return render_blank unless upload_id > 0
size = params[:size].to_i
return render_blank if size < 8 || size > 1000
@ -98,7 +98,7 @@ class UserAvatarsController < ApplicationController
return redirect_to cdn_path(avatar_url)
end
upload = Upload.find_by(id: upload_id) if user_avatar.contains_upload?(upload_id)
upload = Upload.find_by(id: upload_id) if user.user_avatar.contains_upload?(upload_id)
upload ||= user.uploaded_avatar if user.uploaded_avatar_id == upload_id
if user.uploaded_avatar && !upload