Skip to content

A platform for community discussion. Free, open, simple.

FIX: Show correct avatar in post stream bar (#11481)

Penar Musaraj0e210df79a7a
diff --git a/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js b/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js
index e8b84a41f33..614e2251ecf 100644
--- a/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js
+++ b/app/assets/javascripts/discourse/app/components/scrolling-post-stream.js
@@ -41,6 +41,7 @@ export default MountWidget.extend({
return this.getProperties(
"posts",
"canCreatePost",
+ "filteredPostsCount",
"multiSelect",
"gaps",
"selectedQuery",
diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbs
index 86522770cfb..2990ab1f4de 100644
--- a/app/assets/javascripts/discourse/app/templates/topic.hbs
+++ b/app/assets/javascripts/discourse/app/templates/topic.hbs
@@ -200,6 +200,7 @@
canCreatePost=model.details.can_create_post
multiSelect=multiSelect
selectedPostsCount=selectedPostsCount
+ filteredPostsCount=model.postStream.filteredPostsCount
selectedQuery=selectedQuery
gaps=model.postStream.gaps
showReadIndicator=model.show_read_indicator
diff --git a/app/assets/javascripts/discourse/app/widgets/post-stream.js b/app/assets/javascripts/discourse/app/widgets/post-stream.js
index be644e88c8f..b95404a4c21 100644
--- a/app/assets/javascripts/discourse/app/widgets/post-stream.js
+++ b/app/assets/javascripts/discourse/app/widgets/post-stream.js
@@ -119,22 +119,24 @@ createWidget("posts-filtered-notice", {
this.attach("filter-show-all", attrs),
];
} else if (filters.username_filters) {
+ const firstUserPost = attrs.posts[1],
+ userPostsCount = parseInt(attrs.filteredPostsCount, 10) - 1;
return [
h(
"span.filtered-replies-viewing",
I18n.t("post.filtered_replies.viewing_posts_by", {
- post_count: attrs.posts.length,
+ post_count: userPostsCount,
})
),
h(
"span.filtered-avatar",
avatarFor.call(this, "small", {
- template: attrs.posts[0].avatar_template,
- username: attrs.posts[0].username,
- url: attrs.posts[0].usernameUrl,
+ template: firstUserPost.avatar_template,
+ username: firstUserPost.username,
+ url: firstUserPost.usernameUrl,
})
),
- this.attach("poster-name", attrs.posts[0]),
+ this.attach("poster-name", firstUserPost),
this.attach("filter-show-all", attrs),
];
}
@@ -282,6 +284,7 @@ export default createWidget("post-stream", {
this.attach("posts-filtered-notice", {
posts: postArray,
streamFilters: attrs.streamFilters,
+ filteredPostsCount: attrs.filteredPostsCount,
})
);
}