FIX: use provided avatar_template instead of always computing it

This commit is contained in:
Régis Hanol 2015-05-29 10:19:51 +02:00
parent c3227b69fa
commit 95fb32f3e5

View file

@ -14,17 +14,15 @@ Em.Handlebars.helper('bound-avatar', function(user, size, uploadId) {
if (Em.isEmpty(user)) {
return new safe("<div class='avatar-placeholder'></div>");
}
var username = Em.get(user, 'username');
if(arguments.length < 4){
uploadId = Em.get(user, 'uploaded_avatar_id');
}
if (arguments.length < 4) { uploadId = Em.get(user, 'uploaded_avatar_id'); }
return new safe(Discourse.Utilities.avatarImg({
size: size,
avatarTemplate: avatarTemplate(username, uploadId)
}));
}, 'username', 'uploaded_avatar_id');
var avatar = Em.get(user, 'avatar_template') || avatarTemplate(username, uploadId);
return new safe(Discourse.Utilities.avatarImg({ size: size, avatarTemplate: avatar }));
}, 'username', 'uploaded_avatar_id', 'avatar_template');
/*
* Used when we only have a template