fix: fix filter and sorting effect in discussion sidebar (#438)

* fix: fix filter and sorting effect in discussion sidebar

* test: fix test cases
This commit is contained in:
ayesha waris
2023-02-17 00:45:18 +05:00
committed by GitHub
parent e99c30f213
commit 1c2da56e3b
2 changed files with 2 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ function CategoryPostsList({ category }) {
const groupedCategory = useSelector(selectCurrentCategoryGrouping)(category);
// If grouping at subsection is enabled, only apply it when browsing discussions in context in the learning MFE.
const topicIds = useSelector(selectTopicsUnderCategory)(enableInContextSidebar ? groupedCategory : category);
const posts = useSelector(selectTopicThreads(topicIds));
const posts = useSelector(enableInContextSidebar ? selectAllThreads : selectTopicThreads(topicIds));
return <PostsList posts={posts} topics={topicIds} />;
}

View File

@@ -191,7 +191,7 @@ describe('PostsView', () => {
.toHaveLength(topicThreadCount);
// When grouping is enabled, topic 1 will be shown, but not otherwise.
expect(screen.queryAllByText(/this is thread-\d+ in topic some-topic-1/i))
.toHaveLength(grouping ? topicThreadCount : 0);
.toHaveLength(grouping ? topicThreadCount : 2);
},
);
});