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

Also fixes the displayed count of posts when filtered by user.
This commit is contained in:
Penar Musaraj 2020-12-14 15:24:15 -05:00 committed by GitHub
parent b45a30c40f
commit 0e210df79a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -41,6 +41,7 @@ export default MountWidget.extend({
return this.getProperties(
"posts",
"canCreatePost",
"filteredPostsCount",
"multiSelect",
"gaps",
"selectedQuery",

View File

@ -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

View File

@ -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,
})
);
}