BUGFIX: avatar in history dialog

This commit is contained in:
Régis Hanol 2014-06-04 18:35:14 +02:00
parent cc3119f003
commit bc7730e0dd
3 changed files with 9 additions and 11 deletions

View File

@ -228,13 +228,13 @@ Ember.Handlebars.registerBoundHelper('boundAvatar', function(user, size, uploadI
uploadId = Em.get(user, 'uploaded_avatar_id');
}
var avatarTemplate = Discourse.User.avatarTemplate(username,uploadId);
var avatarTemplate = Discourse.User.avatarTemplate(username, uploadId);
return new Handlebars.SafeString(Discourse.Utilities.avatarImg({
size: size,
avatarTemplate: avatarTemplate
}));
}, 'uploaded_avatar_id');
}, 'username', 'uploaded_avatar_id');
/*
* Used when we only have a template

View File

@ -327,8 +327,8 @@ Discourse.User = Discourse.Model.extend({
});
},
avatarTemplate: function(){
return Discourse.User.avatarTemplate(this.get('username'),this.get('uploaded_avatar_id'));
avatarTemplate: function() {
return Discourse.User.avatarTemplate(this.get('username'), this.get('uploaded_avatar_id'));
}.property('uploaded_avatar_id', 'username'),
/*
@ -416,17 +416,15 @@ Discourse.User = Discourse.Model.extend({
Discourse.User.reopenClass(Discourse.Singleton, {
avatarTemplate: function(username, uploadedAvatarId){
avatarTemplate: function(username, uploadedAvatarId) {
var url;
if(uploadedAvatarId){
if (uploadedAvatarId) {
url = "/user_avatar/" +
Discourse.BaseUrl +
"/" +
username.toLowerCase() +
"/{size}/" +
uploadedAvatarId + ".png";
} else {
url = "/letter_avatar/" +
username.toLowerCase() +
@ -435,7 +433,7 @@ Discourse.User.reopenClass(Discourse.Singleton, {
}
url = Discourse.getURL(url);
if(Discourse.CDN){
if (Discourse.CDN) {
url = Discourse.CDN + url;
}
return url;

View File

@ -17,7 +17,7 @@
</div>
</div>
<div id="revision-details">
{{i18n post.revisions.details.edited_by}} {{boundAvatar content "small"}} {{username}} <span class="date">{{date created_at}}</span> {{#if edit_reason}} &mdash; <span class="edit-reason">{{edit_reason}}</span>{{/if}}
{{i18n post.revisions.details.edited_by}} {{boundAvatarTemplate content.avatar_template "small"}} {{username}} <span class="date">{{date created_at}}</span> {{#if edit_reason}} &mdash; <span class="edit-reason">{{edit_reason}}</span>{{/if}}
</div>
<div id="revisions">
{{#if title_changes}}
@ -32,7 +32,7 @@
{{/if}}
{{#if user_changes}}
<div class="row">
{{boundAvatar user_changes.previous "small"}} {{user_changes.previous.username}}{{boundAvatar user_changes.current imageSize="small"}} {{user_changes.current.username}}
{{boundAvatarTemplate user_changes.previous.avatar_template "small"}} {{user_changes.previous.username}}{{boundAvatarTemplate user_changes.current.avatar_template "small"}} {{user_changes.current.username}}
</div>
{{/if}}
{{#if wiki_changes}}