FIX: stop showing incorrect avatars in quote

This commit is contained in:
Sam 2015-08-05 19:22:51 +10:00
parent 4486879fd2
commit aef575aad0
2 changed files with 5 additions and 3 deletions

View File

@ -26,7 +26,9 @@ Discourse.BBCode.register('quote', {noWrap: true, singlePara: true}, function(co
if (options.lookupAvatarByPostNumber) {
// client-side, we can retrieve the avatar from the post
var postNumber = parseInt(params['data-post'], 10);
avatarImg = options.lookupAvatarByPostNumber(postNumber);
var topicId = parseInt(params['data-topic'], 10);
avatarImg = options.lookupAvatarByPostNumber(postNumber, topicId);
} else if (options.lookupAvatar) {
// server-side, we need to lookup the avatar from the username
avatarImg = options.lookupAvatar(username);

View File

@ -260,9 +260,9 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
this.editor = editor = Discourse.Markdown.createEditor({
containerElement: this.element,
lookupAvatarByPostNumber(postNumber) {
lookupAvatarByPostNumber(postNumber, topicId) {
const posts = self.get('controller.controllers.topic.model.postStream.posts');
if (posts) {
if (posts && topicId === self.get('controller.controllers.topic.model.id')) {
const quotedPost = posts.findProperty("post_number", postNumber);
if (quotedPost) {
const username = quotedPost.get('username'),